Re: Strange C constructs

Derek M Jones <derek@NOSPAMknosof.co.uk>
26 Feb 2004 09:59:50 -0500

          From comp.compilers

Related articles
Strange C constructs vbdis@aol.com (2004-02-26)
Re: Strange C constructs derek@NOSPAMknosof.co.uk (Derek M Jones) (2004-02-26)
Re: Strange C constructs iddw@hotmail.com (2004-02-27)
Re: Strange C constructs jeremy@jdyallop.freeserve.co.uk (Jeremy Yallop) (2004-02-27)
Re: Strange C constructs alexc@std.com (Alex Colvin) (2004-02-27)
Re: Strange C constructs derek@NOSPAMknosof.co.uk (Derek M Jones) (2004-03-02)
Re: Strange C constructs david.thompson1@worldnet.att.net (Dave Thompson) (2004-03-02)
Re: Strange C constructs vbdis@aol.com (2004-03-02)
[3 later articles]
| List of all articles for this month |
From: Derek M Jones <derek@NOSPAMknosof.co.uk>
Newsgroups: comp.compilers
Date: 26 Feb 2004 09:59:50 -0500
Organization: Knowledge Software
References: 04-02-147
Keywords: C
Posted-Date: 26 Feb 2004 09:59:50 EST

DoDI,


> 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 /##/


It was probably surrounded by a #if that included:


#else
#define something
#endif


> 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.


Correct.


> Is this construct really a stupid Microsoft extension,


I imagine they have customers who think it is an intelligent extension.


> intended to
> prevent the compilation of Windows code with other compilers, or did I
> miss something in the newer C specs?


It does not prevent other compilers from processing this source. But
it does require that they support this construct.


> Another question may be easier to answer:
>
> typedef int (procname)(int arg);
>
> According to K&R only /pointers/ to procedure-types can be constructed.


Hang on. I thought you were a fan of standards?


> Does there exist newer specs which allow to typedef procedures
> themselves?


If you mean C99, then no. If you mean vendor extensions, I cannot
think of any.


Post a followup to this message

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