c++ - Preprocessor bug with -A: //*
- "Luna Kid" <lunakid neuropolis.org> Nov 01 2003
With dmc -A, this is fine: #if 0 #endif //* and this: #if 0 //* #endif and this: #define X //* but this one fails: #if 0 #endif //* and this, too: #if 0 #else //* #endif with: Lexical error: end of file found before end of comment, line 1 Fatal error: premature end of source file (I found this very annoying while trying to use STLPort.) --------------- Also with -A: Lexical error: last line in file had no \n I feel this should not be an error (unless the warning level is bumped up to warnings --> errors). The std says: "If a source file that is not empty does not end in a new-line character [...] the behavior is undefined." So, it does not mandate an error. And, as to using this error as a portability aid: in practice, I have never heared of such a sloppy compiler that could not cope with it. If still there exists one, it is probably never ever get used by the same nice folks who also use DMC ;) , so trying to alert them does no good. It only annoys. (And helps authors of lame text processing tools to find cheap excuses for not handling EOF-terminated last lines correctly.) Cheers, Sz.
Nov 01 2003