Flexsim completely freezes when compiling Flexscript if there is a function-like macro and the name of the local non-existent variable is the same as the name of the macro parameter:
- #define foo(x) (x)
- // return foo(1); // OK.
- // return foo(undefined); // OK. Compilation error.
- return foo(x); // BUG. Flexsim freezes.
Flexsim becomes unresponsive, but continues running and allocates more and more memory over time. If there was any work in progress (a model), it cannot be saved.
Creating a local variable with the same name or using a local scope is not helpful. It appears that macro parameters use the same namespace as the local variables and take precedence over them.
- #define foo(x) (x)
- {
- int x = 3;
- return foo(x); // BUG. Flexsim freezes.
- }