Path: utzoo!attcan!uunet!husc6!bbn!gatech!dcatla!holos0!lbr From: lbr@holos0.UUCP (Len Reed) Newsgroups: comp.lang.c Subject: Re: defining a comment? Message-ID: <1356@holos0.UUCP> Date: 15 Sep 88 13:33:21 GMT References: <13544@mimsy.UUCP> Organization: Holos Software, Atlanta, GA Lines: 44 From article <13544@mimsy.UUCP>, by chris@mimsy.UUCP (Chris Torek): > In article <5438@techunix.BITNET> benny@techunix.BITNET (Benny Pinkas) writes: >>Can I use the Preprocessor to define a comment? > >>#define STARTCOM /* > > This is rather dubious. > >>Usually the text after the /* is considered as a comment and is not part >>of the macro definition. > > Why should you care? You cannot (portably) view the text (if any) emitted > by the preprocessor, which may well be an integral part of the compiler. You misunderstand. On Xenix and MSC 5.x (where I've tried this) consider: #define COMMENT /* #define CLOSE_COMMENT */ The pre-processor considers these two lines to be functionally equivalent to the single line: #define COMMENT /* #define CLOSE_COMMENT */ which is no different than #define COMMENT This is because comment structures are parsed in the 1st pass before #defines. Comments are not stored in the pre-processor lookup table. Later when you say: COMMENT A whole bunch of stuff CLOSE_COMMENT the compiler tries to compile A whole bunch of stuff CLOSE_COMMENT and messes up. -- - Len Reed