[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] New fun bug! #include <regex.h>

From: Antti-Juhani Kaijanaho
Subject: Re: [Tinycc-devel] New fun bug! #include <regex.h>
Date: Fri, 21 Sep 2007 12:58:37 +0300
User-agent: Mutt/1.5.16 (2007-06-11)

On Fri, Sep 21, 2007 at 10:02:19AM +0200, Marc Andre Tanner wrote:
> Rob Landley wrote:
>> tcc knows how to handle restrict when it's applied in other contexts, but 
>> in this context it seems to make about as much sense as "int array[long];"
> According to the comment in sys/cdefs.h this is valid C99 don't know 
> whether this is true or not.
> /* ISO C99 also allows to declare arrays as non-overlapping. The syntax is
>      array_name[restrict]
>    GCC 3.1 supports this.  */

All type qualifiers and static are allowed there.  The syntax is:

        ( declarator )
        direct-declarator [ type-qualifier-listopt assignment-expressionopt ]
        direct-declarator [ static type-qualifier-listopt assignment-expression 
        direct-declarator [ type-qualifier-list static assignment-expression ]
        direct-declarator [ type-qualifier-listopt * ]
        direct-declarator ( parameter-type-list )
        direct-declarator ( identifier-listopt )


       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.


       If, in the declaration ‘‘T D1’’, D1 has one of the forms:
         D[ type-qualifier-listopt assignment-expressionopt ]
         D[ static type-qualifier-listopt assignment-expression ]
         D[ type-qualifier-list static assignment-expression ]
         D[ type-qualifier-listopt * ]

       ‘‘derived-declarator-type-list T ’’, then the type specified for
       ident is ‘‘derived-declarator-type-list array of T ’’.121) (See for the meaning of the optional type qualifiers and the
       keyword static.)

       121) When several ‘‘array of’’ specifications are adjacent, a
            multidimensional array is declared.

       A declaration of a parameter as ‘‘array of type’’ shall be adjusted to
       ‘‘qualified pointer to type’’, where the type qualifiers (if any)
       are those specified within the [ and ] of the array type
       derivation. If the keyword static also appears within the [ and ]
       of the array type derivation, 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.

(References: C99 6.7.5:1,,,

Antti-Juhani Kaijanaho, Jyväskylä, Finland

reply via email to

[Prev in Thread] Current Thread [Next in Thread]