www.digitalmars.com         C & C++   DMDScript  

c++.idde - Bug: # macro operator fails with .rc files


Using a token replacement macro, followed by a stringizing macro are not
preprocessed as expected in the resource editor, nor in rcc.exe.  However, the
MS rc.exe handles this correctly.

Wow, now thats wordy!  How about an example instead...
#define APP_BUILD_NUMBER        4
#define BUILD_STR_PT2( build )  #build "\0"
#define BUILD_STR( build )      BUILD_STR_PT2( build )

Expected results:

SPECIAL_BUILD_STR should be "4\0".  However, the resource editor and rcc.exe
both see this as "APP_BUILD_NUMBER\0".

Interestingly, if placed in a test.cpp; this is preprocessed as expected.  If
compiled with rc.exe instead of rcc.exe, it is also handled as expected.

How to replicate:

1. Create a .rc file with a version information resource.
2. Place the above example at the top of the .rc file
3. Replace   VALUE "SpecialBuild", "\0"
with      VALUE "SpecialBuild", SPECIAL_BUILD_STR


1. Call rc.exe instead of rcc.exe.
2. Theory: First call the preprocessor sppn.exe on the .rc file.  Then copy the
i output file to a .rc file that will be used by the compiler/IDDE.

OS: XP w/ sp 2
Compiler: Digital Mars CD v 8.42, with cd843.zip

Apologia if this turns out to be user misunderstanding.

MrMarshallMan at Yahoo dot com
May 19 2005