In C you can do something like this:
#define timesten(x) x * 10
y = timesten(5);
This turns into
y = 5 * 10;
(Which the compiler will automatically turn to 50 anyway)
Just a simple example but it allows you to cleanly place complicated expressions in your code without needing a (slow?) function to do it.
I use functions to work out what pixel is in which tile etc that can be done using macros (the #define things).
The BM limited precompiler uses the ? symbol, perhaps we should follow suit in case a popular precompiler is added officially?
?define PROFILING 1
#define timesten(x) x * 10
y = timesten(5);
This turns into
y = 5 * 10;
(Which the compiler will automatically turn to 50 anyway)
Just a simple example but it allows you to cleanly place complicated expressions in your code without needing a (slow?) function to do it.
I use functions to work out what pixel is in which tile etc that can be done using macros (the #define things).
The BM limited precompiler uses the ? symbol, perhaps we should follow suit in case a popular precompiler is added officially?
?define PROFILING 1