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]

Re: Volatile constants?


Kevin Handy <kth@srv.net> writes:
> 
> After preprocess
> 
> 	int s = (-7<0 ? --7 : -7)
> 
> I'd guess that the decrement '--7' is what is causing you the problem
> This is why you should always use extra parentheses in your #defines

This is not true. ANSI-C generates tokens before preprocessing.
The tokens are not concatenated afterwards, unless you use ## 
It should be parsed as - - 7, which is legal C. Maybe some prehistoric
K&R preprocessors do it differently. 
The problem is just that inline calls are not allowed in constant
expressions, and a global definition expects a constant expression
as initializer. inline does not change the grammar here.

-Andi 

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