gcc 4.3 warnings

Skunk Worx skunkworx at verizon.net
Thu Aug 7 05:34:35 UTC 2008


Matthew Saltzman wrote:
> On Tue, 2008-08-05 at 19:49 -0700, Skunk Worx wrote:
>> $ gcc foo.c
>> foo.c:1:16: warning: missing terminating " character
>>
>> $ cat foo.c
>> #define DQUOTE "
>> main() {}
>>
>> A few people at work have mentioned it seems unusual for a preprocessor 
>> to complain about simple macros this way.
>>
>> What do others think of this?
> 
> A macro definition has to consist of a sequence of tokens.  A string
> constant (sequence of characters enclosed in double quotes) is a token,
> but the double quote by itself is not.
> 
> If you are trying to construct strings containing macro defs, look at
> the stringize operator (#) and token merge operator (##)in the
> preprocessor documentation.
> 

Exactly. This code was written circa 1991 and the warnings came with the 
change to Fedora 9.

The preprocessor is being used to generate html code documentation in 
the build, including named anchors (#).

A further review of K&R, and other sources on the web, show the use of 
the preprocessor for this kind of task is not recommended.

Thanks,
John




More information about the users mailing list