Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!apple!motcsd!hpda!hpcuhb!hpcllla!hpclisp!hpclscu!shankar From: shankar@hpclscu.HP.COM (Shankar Unni) Newsgroups: comp.lang.c++ Subject: Re: "//" comments and #define's : problems Message-ID: <1000020@hpclscu.HP.COM> Date: 12 Jul 89 20:27:56 GMT References: <1000019@hpclscu.HP.COM> Organization: Hewlett-Packard Calif. Language Lab Lines: 34 > When fixing up a "cpp" to handle "//"-style comments, I came across an > interesting problem. I've already received several messages pointing out page 130 of the Bible to me. I guess my reading of that part of the book was a little perfunctory. However, after reading that page, I'm still uncomfortable with it. What that page is trying to do is treat the preprocessing phase as something separate from the C++ language, and cramming the C preprocessing semantics down the throat of C++ (since the C language does not have "//" comments, let's make them work only on the lines unaffected by the preprocessor..). The first thing we need to do is to look at the whole setup in a unified fashion. Either macros and ifdef's are in the language, or they are not. If they are, then the preprocessing phase is an essential part of the language, and should work coherently with the other aspects of the language, like "//" comments. If they are not, then that fact should be mentioned explicitly up front. Since they are mentioned in pages 129 and 130, and also in sec 7.3.5 (generic classes), I assume that they are part of the language. It does not take a great effort to define precise semantics for the preprocessing phase. For instance, in ANSI C, the precise semantics are defined in sections 2.1.1.2 (translation phases) and 3.7 (preprocessor directives). Incidentally, in the ANSI standard, the comments are stripped from the macro replacement text UP FRONT (i.e. even before processing the #define directive), so page 130 of the Bible will have to change a bit. What do you say? ----- Shankar Unni E-Mail: Hewlett-Packard California Language Lab. Internet: shankar@hpda.hp.com Phone : (408) 447-5797 UUCP: ...!hplabs!hpda!shankar