Article View: comp.std.c
Article #4768Re: A question about: #define
From: Mike Rubenstein
Date: Mon, 12 Feb 1996 12:25
Date: Mon, 12 Feb 1996 12:25
22 lines
1126 bytes
1126 bytes
tobbe@erix.ericsson.se (Torbj|rn T|rnkvist) wrote: > > I'm wondering if the following preprocessor directive is > permissible in ANSI C ? > > #define A #define B > > I couldn't see from from my Harbison,Steele, "A C Reference Manual", > if it is ok or not (gcc -ansi -pedantic accept this but the Sun > ANSI-C compiler does not...). It depends on what you mean. It's legal to define A like that, but using A as a macro in your program is not. From ISO 6.8.3.4: The resulting [from macro expansion] completely macro-replaced preprocessing token sequence is not processed as a preprocessing directive even if it resembles one. Michael M Rubenstein
Technical Details
Message-ID:
<311f3104.236842591@nntp.ix.netcom.com>Path:
arc1-ca.pugleaf.net!ix.netcom.com!netnewsReferences:
<qug2cgc3xo.fsf@chivas.eua.ericsson.se>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!ix.netcom.com!netnews From: miker3@ix.netcom.com (Mike Rubenstein) Newsgroups: comp.std.c Subject: Re: A question about: #define Date: Mon, 12 Feb 1996 12:25:02 GMT Organization: Netcom Message-ID: <311f3104.236842591@nntp.ix.netcom.com> References: <qug2cgc3xo.fsf@chivas.eua.ericsson.se> NNTP-Posting-Host: ix-dc10-11.ix.netcom.com X-NETCOM-Date: Mon Feb 12 4:24:48 AM PST 1996 X-Newsreader: Forte Agent .99d/32.182