Subject: Re: __restrict and arrays
To: None <tech-userlevel@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: tech-userlevel
Date: 06/17/2007 18:02:41
In article <20070617020826.A80C2D2B88F@mail.connecty.lt>,
Mindaugas R. <rmind@NetBSD.org> wrote:
>Hello,
>there is an issue with GCC 3.x and aio.h file. This header contains such line:
>
>int lio_listio(int, struct aiocb * const __restrict [],
> int, struct sigevent * __restrict);
>
>There should be a C99 specifier "[__restrict]", which is actually not
>compatible with older GCC versions than 3.1. I am not sure what would be an
>appropriate way to fix this...
>
>a) Declare something like __restrict_array macro in sys/cdefs.h :
>#if __GNUC_PREREQ__(3, 1)
>#define __restrict_array __restrict
>#else
>#define __restrict_array /* Nothing */
>#endif
>It would be used as:
> struct aiocb * const [__restrict_array]
>
>b) Instead, use something like:
> struct aiocb * const __restrict *
>
I think b is better because it is simpler. Unless the standards mandate
an array.
christos