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? - DMBug.c
It's my first message here, I hope I've choosen the right group. We have a big portable source code package written in C (ANSI C 1990) here. To find out portability issues before our customers have to, I ported it to several compilers, including Digital Mars. I ran into a problem, and spend several hours now to isolate it and make a small example source file (attached). I'm using the command line version of Digital Mars 8.41n on a Windows XP machine. Compiling the attached file with options -c -mn -r leads to the errors "function 'xxx' has no prototype" for 'int_Greater', 'float_Sub', 'double_Sub'. It seems this is a problem with the preprocessor. Replacing option -r with -e and -lDMBug.lst shows that the preprocessor correctly replaces the macro EPSILON_UNSIGN and EPSILON_SIGN respectively, but it has problems doing further macro replacements on the resulting string. In the case of EPSILON_UNSIGN, no further replacement takes place, while on EPSILON_SIGN, xxx_Greater and xxx_Positive are replaced but not xxx_Sub ?!? I have to admit that this code is tricky. But according to my understanding of the ANSI C standard, this should be legal. Also, all the other compilers processed that code without problems. Thanks in advance for your efforts Dipl-Inf. Herbert Oppmann Siemens AG, Automation & Drives Nürnberg, Germany Nov 26 2004
Herbert.Oppmann siemens.com wrote:It seems this is a problem with the preprocessor. Replacing option -r with -e and -lDMBug.lst shows that the preprocessor correctly replaces the macro EPSILON_UNSIGN and EPSILON_SIGN respectively, but it has problems doing further macro replacements on the resulting string. In the case of EPSILON_UNSIGN, no further replacement takes place, while on EPSILON_SIGN, xxx_Greater and xxx_Positive are replaced but not xxx_Sub ?!? Dec 08 2004
In article <cp6jor$1daf$1 digitaldaemon.com>, Daniel James says...It might be too late to help you, but I came across the same bug a while ago, and found a few work arounds. Dec 13 2004
"Herbert Oppmann" <Herbert_member pathlink.com> wrote in message news:cpjpi0$1aes$1 digitaldaemon.com...Daniel, thanks a lot for your suggestions. Unfortunately, I won't use them, but it will help other users reading this forum. The Digital Mars compiler is not one of our targets and I only used it to Dec 15 2004
|