Strange C constructs (VBDis)
26 Feb 2004 01:08:58 -0500

          From comp.compilers

Related articles
Strange C constructs (2004-02-26)
Re: Strange C constructs (Derek M Jones) (2004-02-26)
Re: Strange C constructs (2004-02-27)
Re: Strange C constructs (Jeremy Yallop) (2004-02-27)
Re: Strange C constructs (Alex Colvin) (2004-02-27)
Re: Strange C constructs (Derek M Jones) (2004-03-02)
Re: Strange C constructs (Dave Thompson) (2004-03-02)
[4 later articles]
| List of all articles for this month |

From: (VBDis)
Newsgroups: comp.compilers
Date: 26 Feb 2004 01:08:58 -0500
Organization: AOL Bertelsmann Online GmbH & Co. KG
Keywords: C, question
Posted-Date: 26 Feb 2004 01:08:58 EST

My selfmade C preprocessor stumbled across a strange construct in one of the
Windows headers. Now I would like to know whether this really makes sense:

#define something /##/

I can imagine that the intended effect is the creation of an comment
(// ...) in the source code, but IMO this is not achievable in
accordance to any C/C++ standard. An traditional preprocessor doesn't
recognize the ## operator, and newer preprocessors have to treat
comments before, or during, the tokenization, whereas the ## operator
is executing after tokenization, and there exists no valid
preprocessor token for "//".

Is this construct really a stupid Microsoft extension, intended to prevent the
compilation of Windows code with other compilers, or did I miss something in
the newer C specs?

Another question may be easier to answer:

typedef int (procname)(int arg);

According to K&R only /pointers/ to procedure-types can be constructed. Does
there exist newer specs which allow to typedef procedures themselves?


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.