I want to use a preprocessor macro inside an #if directive.
The value of this macro is obtained from a second macro.
If the name of the second macro is longer than some seemingly arbitrary limit, the compiler fails with a confusing error message.
Numbered Steps to Reproduce Problem:
- Try to compile the following code
Code Snippet (if applicable) to Reproduce Problem:
Demo project is available here: https://github.com/DamianX/junk/raw/master/test6.zip
#define SHORTTHING 0
#define STUFF SHORTTHING
#if SHORTTHING == 0
#define LONGER_NAME_OF_THING 0
#define LONGER_STUFF LONGER_NAME_OF_THING
#if LONGER_STUFF == 0
This should compile.
It doesn't compile. Specifically, the first set of macros (SHORTTHING and STUFF) works fine, the second set of macros (LONGER_NAME_OF_THING and LONGER_STUFF) don't.
test6.dm:10:error: unexpected token: HING
test6.dmb - 1 error, 0 warnings
Does the problem occur:
Every time? Or how often? Every time.
In other games? N/A
In other user accounts? N/A
On other computers? Yep.
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? Reproduced this under windows 10 x64 with BYOND versions 510.1347 and 512.1452. Also reproduced this under Ubuntu x64 with BYOND version 512.1448.
Shorter names seem to work, for some reason.