Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!uwm.edu!cs.utexas.edu!uunet!microsoft!jimad From: jimad@microsoft.UUCP (Jim ADCOCK) Newsgroups: comp.lang.c++ Subject: Re: cpp and _main() Keywords: cpp, initialization, macro replacement Message-ID: <59854@microsoft.UUCP> Date: 14 Dec 90 19:53:18 GMT References: <1204@halley.UUCP> Reply-To: jimad@microsoft.UUCP (Jim ADCOCK) Organization: Microsoft Corp., Redmond WA Lines: 34 In article <1204@halley.UUCP> kelley@halley.UUCP (Michael Kelley) writes: | |I've got a couple more questions. The first concerns pre-processing: |is the text replacement for a macro containing a C++ style comment defined? Yes, see ARM's chapter on pre-processor. [and/] |or will it vary from cpp to cpp? Yes, because today's implementations of cpp's are not very good at following the C++ definition. There are at least four major flavors of cpp's in use today. Those following K&R, those following ANSI-C, those following ARM, and those doing entirely their own thing. If one wants to port software easily today then, one would do best not to rely on fine-grained details of the cpp implemention. |That is, if I have an ostream for debugging, |named cdbg, can I do this to take out the code when not debugging: | |#ifndef DEBUG |extern ostream cdbg; |#else |#define cdbg // |#endif As I understand it, in theory each comment should be converted to a single white space at a pre-processing phase prior to macro evaluation and expansion. So your cdbg line is equivalent to: #define cdbg In practice, many cpps still do not recognize // as a comment, so the behavior you get will probably vary.