🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

3 total messages Started by Michael Cook Wed, 06 Mar 1996 20:51
#endif //
#3607
Author: Michael Cook
Date: Wed, 06 Mar 1996 20:51
12 lines
1071 bytes
Is it legal to have //-style comments within a preprocessor directive?  If so,
that'd mean C++ compilers would be precluded from using ISO C preprocessors.

Michael.


[ 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
]
Re: #endif //
#3619
Author: 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 
]
Re: #endif //
#3622
Author: Zefram
Date: Fri, 08 Mar 1996 17:07
19 lines
1698 bytes
Michael Cook  <mcook@cognex.com> wrote:
>Is it legal to have //-style comments within a preprocessor directive?  If so,
>that'd mean C++ compilers would be precluded from using ISO C preprocessors.

That is correct.  Comments are converted into spaces before
preprocessing occurs.  In practice, it is common for a single
preprocessor program to have two modes of operation, one in which //
starts a comment and one in which it does not.  That preprocessor can
then be used for both languages.  (Actually other options are needed
too, controlling which digraphs are recognised.)

-zefram
---
[ 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 
]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads