12.01.2017, 21:26
Is possible to use a macro with #defined integer parameters?
Example:
The macro above will generate this code:
But I want that:
Looking at the generated code by the macros, I realized that this will only happen if I use an invalid character, like that:
But it will not even compile (Will compile running pawncc file -l) because it's not a valid function name.
I tried a ton of things, like redefine MyTestFunction_: to MyTest_ but TEST_VALUE will be replaced by 10 only if after or between invalid characters.
Thank you for understand my english.
Example:
PHP код:
#define Test:%0(%1) \
forward MyTestFunction_%0(%1); \
public MyTestFunction_%0(%1)
#define TEST_VALUE 10
Test:TEST_VALUE(playerid)
{
}
PHP код:
forward MyTestFunction_TEST_VALUE(playerid);
public MyTestFunction_TEST_VALUE(playerid)
{
}
PHP код:
forward MyTestFunction_10(playerid);
public MyTestFunction_10(playerid)
{
}
PHP код:
#define Test:%0(%1) \
forward MyTestFunction_:%0(%1); \
public MyTestFunction_:%0(%1)
Test:TEST_VALUE(playerid)
{
}
//Will generate
forward MyTestFunction_:10(playerid);
public MyTestFunction_:10(playerid)
{
}
I tried a ton of things, like redefine MyTestFunction_: to MyTest_ but TEST_VALUE will be replaced by 10 only if after or between invalid characters.
Thank you for understand my english.