[cfe-dev] static keyword @ Function declarators...

Richard Smith richard at metafoo.co.uk
Wed Sep 12 01:23:03 PDT 2012


On Wed, Sep 12, 2012 at 12:16 AM, Umesh Kalappa <umesh.kalappa0 at gmail.com>wrote:

> Hi All ,
> Was going through the C99 standard @
> http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf 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 ??
>

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120912/d7bba6cd/attachment.html>


More information about the cfe-dev mailing list