D
Deleted member 45063
Guest
Hello GMC,
When using macros I expect that they will be fully expanded before any attempts on actual compilation of the GML code (like separate preprocessor and compilation phases). However I noticed that it doesn't seem to always be the case. For example:
Create a new project and in the room creation event of the only room add:
Looking at the code I would expect it to be expanded to:
Yet it gives a compile-time error:
But if we change it to:
Then it compiles and behaves as expected. This means that multi-pass macro expansion does work just that it doesn't seem to be consistent in all scenarios.
I was wondering if this is to be expected of if it is indeed a bug with the macro system.
Runtime Version: 2.2.4.374
When using macros I expect that they will be fully expanded before any attempts on actual compilation of the GML code (like separate preprocessor and compilation phases). However I noticed that it doesn't seem to always be the case. For example:
Create a new project and in the room creation event of the only room add:
Code:
#macro HELLO_WORLD "Hello World!"
#macro MESSAGE HELLO_WORLD
#macro LOG_FUNCTION show_debug_message
#macro DEBUG LOG_FUNCTION
DEBUG(MESSAGE);
Code:
show_debug_message("Hello World!");
Code:
Creation Code in Room: room0 at line 7 : unknown function or script LOG_FUNCTION
Code:
#macro HELLO_WORLD "Hello World!"
#macro MESSAGE HELLO_WORLD
#macro LOG_FUNCTION show_debug_message
#macro DEBUG LOG_FUNCTION
LOG_FUNCTION(MESSAGE);
I was wondering if this is to be expected of if it is indeed a bug with the macro system.
Runtime Version: 2.2.4.374