Article View: comp.std.c
Article #4766Re: A question about: #define
From: Christopher R Volpe
Date: Mon, 12 Feb 1996 22:27
Date: Mon, 12 Feb 1996 22:27
32 lines
1666 bytes
1666 bytes
Mike Rubenstein wrote: > > 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 > > 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. The fact that the result is not processed as a preprocessing directive even if it resembles one does not necessarily mean that the use of macro A above would be illegal. I suspect you pass A as an argument to another macro that stringizes the expansion of its parameter, or something along those lines. I haven't really thought about it that much so I'm guessing. -- Chris Volpe Phone: (518) 387-7766 (Dial Comm 8*833 GE Corporate R&D Fax: (518) 387-6560 PO Box 8, Schenectady, NY 12301 Email: volpecr@crd.ge.com
Technical Details
Message-ID:
<311FBEC7.A84@ash.crd.ge.com>Path:
arc1-ca.pugleaf.net!news.crd.ge.com!usenetReferences:
<qug2cgc3xo.fsf@chivas.eua.ericsson.se> <311f3104.236842591@nntp.ix.netcom.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.crd.ge.com!usenet From: Christopher R Volpe <volpe@ash.crd.ge.com> Newsgroups: comp.std.c Subject: Re: A question about: #define Date: Mon, 12 Feb 1996 17:27:19 -0500 Organization: GE Corporate Research & Development, Schenectady, NY Message-ID: <311FBEC7.A84@ash.crd.ge.com> References: <qug2cgc3xo.fsf@chivas.eua.ericsson.se> <311f3104.236842591@nntp.ix.netcom.com> NNTP-Posting-Host: bart.crd.ge.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 2.0 (X11; I; SunOS 5.4 sun4m)