ID:2568559
 
BYOND Version:513.1521
Operating System:Windows 10 Home 64-bit
Web Browser:Firefox 75.0
Applies to:Dream Maker
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary:
Using a macro function to define the value of macros in long recursive chains - normally using long recursive chains will throw errors - can cause Dream Maker to silently close down without warning when #undef is used before actual use of any of the macros.

Numbered Steps to Reproduce Problem:
1. If required for consistent reproduction, acquire a copy of a SS13 fork. I was working against a Baystation12 fork when this occured.
2. Do something like the code snippet below
3. Include it, in one way or other
4. Compile

Code Snippet (if applicable) to Reproduce Problem:
#define ABOVE(x) x + 1

#define LAYER_0 0
#define LAYER_1 ABOVE(LAYER_0)
#define LAYER_2 ABOVE(LAYER_1)
// ...
#define LAYER_23 ABOVE(LAYER_22)
#define LAYER_24 ABOVE(LAYER_23)

// This is where it'd crash
#undef ABOVE

/obj
layer = LAYER_24


Expected Results:
* Not crash
* Give an detailed error on the problem

Actual Results:
* Silent crash without any warning

Does the problem occur:
Every time? Or how often? Consistently every time when attempting to do this on a fork of SS13.
In other games? Unknown
In other user accounts? N/A
On other computers? Unknown

When does the problem NOT occur?
Removing the #undef from the code will instead prompt an output of errors. Usually about "macro recursion level too deep"

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? Not known, untested

Workarounds:
* A proposed solution to prevent crashing and prompt errors is not using #undef
* Don't use recursive macro chains at all