#undef-ing a defined value on the next non-blank line (or in a chain of #undef which starts at that line) after using it in a "[]" expression makes the "[]" expression not compile
Numbered Steps to Reproduce Problem:
1. Attempt to compile code below.
Code Snippet (if applicable) to Reproduce Problem:
/proc/foo()
#define FOO 1
#define BAR 2
switch(rand(1,2))
if(1) return "[FOO]"
if(2) return "[BAR]" // error: BAR: undefined var
#undef FOO
#undef BAR
/proc/bar()
#define FOO 2
return "[FOO]" // error: FOO: undefined var
#undef FOO
/proc/foo2()
#define FOO 1
#define BAR 2
switch(rand(1,2))
if(1) return FOO
if(2) return BAR // this is ok
#undef FOO
#undef BAR
/proc/bar2()
#define FOO 2
return FOO // this is ok
#undef FOO
Expected Results: Compilation success, since all defines are only used between being defined and undefined.
Actual Results: Compilation failure.
Does the problem occur:
Every time? Or how often? Every time.
In other games? N/A
In other user accounts? Unknown
On other computers? Unknown
When does the problem NOT occur? Unknown
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? Unknown
Workarounds: Insert a do-nothing statement before the #undef, eg .=.
edit: moved the #foo over so it highlights right
That's the whole point of them, to handle certain things before the code is compiled and to conditionally compile code, they're not processed inline and shouldn't be.