Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - Preprocessor bug with -A: //*
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
|