static keyword @ Function declarators...

Hi All ,
Was going through the C99 standard @ which states that the Function declarators as

direct-declarator ( parameter-type-list )

parameter-list: parameter-declaration

parameter-list , parameter-declaration

parameter-declaration: declaration-specifiers declarator

declaration-specifiers abstract-declarator

direct-declarator [ static type-qualifier-listopt assignment-expression ]

where The optional type qualifiers and the keyword static shall appear only in a declaration of a function parameter with an array type, and then only in the outermost
array type derivation and then for each call to the function, the value of the corresponding actual argument shall provide access to the first element of an array with at least as many elements as specified by the size expression.

for example : int func(array[static int i =100) ;

I’m trying to get the test case for the above function prototype ??? Please someone can shed some lights here ??


Hi Umesh, this sounds like a question for the clang mailing list, not this one.

Ciao, Duncan.

I’m not sure what you’re looking for, but there are a few errors in your example, which might be hindering you. Try:

int func(int array[static 100]);

Clang has some test cases for this in test/Sema/static-array.c.

Hi Richard,

Thank you for the reply and I’m looking at real/piratical cases or need that requires the prototype like int func(int array[static 100]).


I don’t have code that use it right here but for example you may want to write a function that read a 32 bytes fixed size header.

Whatever_t readHeader(char bytes[static 32]);

Thanks Jean for the information :slight_smile: