Re: Strange C constructs

nmm1@cus.cam.ac.uk (Nick Maclaren)
11 Mar 2004 12:45:51 -0500

          From comp.compilers

Related articles
[4 earlier articles]
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)
Re: Strange C constructs viz@pisem.net (Victor Zverovich) (2004-03-02)
Re: Strange C constructs RLake@oxfam.org.pe (2004-03-06)
Re: Strange C constructs nmm1@cus.cam.ac.uk (2004-03-11)
| List of all articles for this month |

From: nmm1@cus.cam.ac.uk (Nick Maclaren)
Newsgroups: comp.compilers
Date: 11 Mar 2004 12:45:51 -0500
Organization: University of Cambridge, England
References: 04-02-147 04-03-019 04-03-022
Keywords: C, standards
Posted-Date: 11 Mar 2004 12:45:51 EST

    <RLake@oxfam.org.pe> wrote:
>> The newest C99 standard introduces single line comments (//...), but
>> it can be formed in such a way using macro substitution and glueing.
> ^not I think you meant to say


I hope so :-)


>> It is shown in the following example stolen from the standard:
>
>> #define glue(x,y) x##y
>> glue(/,/) k(); // syntax error, not comment
>
>> K&R and previous C standard doesn't have such type of comment.
>> So this code (AFAIK it is located in WTypes.h) is completely illegal
>> in C and intended for use with brain-damadged Microsoft compilers.


Yes and no. 'K&R C' was a very broad church, and there were lots of
variations (which was part of the difficulty in defining C90); because
that comment form existed in BCPL, I will bet that at least one such
compiler supported it! Also, it is perfectly permissible to allow
syntactic extensions in C90 and C99 compilers if they issue a warning
about extensions being used.




Regards,
Nick Maclaren.


Post a followup to this message

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