Subject: Re: __restrict and arrays
To: None <,>
From: Mindaugas R. <>
List: tech-userlevel
Date: 06/17/2007 15:24:37
After investigating this a little bit more, I would like to shortly summarize
the problem. POSIX defines [1] lio_listio() like this:

int lio_listio(int mode, struct aiocb *restrict const list[restrict],
	    int nent, struct sigevent *restrict sig); 

The use of "array[restrict]" is defined by ISO C99 standard, and works well
with GCC 3.1 and newer versions. But the definition in prototype without
variable name seems to be not correct, and GCC (both the 4.x and 3.x) will
fail with errors on such test-source:

void test1(int [__restrict]);
int main() { return 0; }
void test1(int array[__restrict]) { return; }

It is quite not clear, but seems there is a problem report [2], which touches
this problem. Hence, we should find out the solution here.
Few ways how other handles this:
o glibc defines the __restrict_arr and use the variable name in the prototypes
o OpenSolaris use the variant B (two *), which I have already suggested
o FreeBSD does not use C99 "restrict" at all



Best regards,