This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC rejecting (I think) valid code


"Sam Lauber" <sam124@operamail.com> writes:

> I compile this pair of declarations with GCC (which would 
> probably be found in a stdint.h):
>
> typedef short int16_t;
> typedef unsigned int16_t uint16_t;
>
> The first declaration is OK, but GCC gives me an error on 
> the second one. That dosen't make sense, because part of 
> the C89 grammar is
>
> type-name:
> (some types) typedef-name
>
> typedef-declaration: something like
> `typedef' type-name typedef-name

There is more to C than the syntax.  The standard also contains semantic
constraints that are to be applied on top of the syntax.  I can't check
C89, but in C99 section 6.7.2 contains an exhaustive list of allowed
type-specifier sets in a type-name, and this list only allows a single
typedef-name not mixed with other type-specifiers for each type-name.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]