🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3619

Re: #endif //

#3619
From: Steve Clamage
Date: Wed, 06 Mar 1996 21:56
30 lines
2039 bytes
In article fsf@erawan.cognex.com, Michael Cook <mcook@cognex.com> writes:
>Is it legal to have //-style comments within a preprocessor directive?

Yes.

>  If so,
>that'd mean C++ compilers would be precluded from using ISO C preprocessors.

Preprocessing is not a separate translation step according to the C and
C++ language definitions. The preprocessing need not be an identifiable
step, nor is there any requirement to provide preprocessed output.

If an implementation chooses to make preprocessing a separate step (or
a separable step) it may do so. The preprocessing rules for C and C++ are 
not quite the same, due to //-comments in C++, so a shared preprocessor
would have to take that into account. Such shared preprocessors typically
take a command-line flag to say whether it is dealing with C or C++ code.

C will almost certainly adopt //-comments, and some C compilers currently
accept them anyway. Thus, the point will soon be moot.

---
Steve Clamage, stephen.clamage@eng.sun.com
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]
Technical Details
Message-ID: <4hl104$mrc@engnews1.Eng.Sun.COM>
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austern
References: <r4lolec6xs.fsf@erawan.cognex.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austern
From: clamage@Eng.Sun.COM (Steve Clamage)
Newsgroups: comp.std.c++
Subject: Re: #endif //
Date: 06 Mar 1996 13:56:31 PST
Organization: Sun Microsystems Inc.
Approved: austern@isolde.mti.sgi.com
Message-ID: <4hl104$mrc@engnews1.Eng.Sun.COM>
References: <r4lolec6xs.fsf@erawan.cognex.com>
Reply-To: clamage@Eng.Sun.COM
NNTP-Posting-Host: isolde.mti.sgi.com
X-Original-Date: 6 Mar 1996 21:44:36 GMT
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBVAwUBMT4KJky4NqrwXLNJAQH0FAIAqG/2D+cUFuvLt3zimggMMqCnFCQ4L6TG
 nXT60WqcH/w+NRD0tIOBSx2TO4WQJwQ8t/8pM/jEkZpetjv8wep9QQ==
 =AY4C
Originator: austern@isolde.mti.sgi.com