Using a clock of code in two places
Posted: Wed Jul 11, 2012 12:52 pm
I have some like
Where I want to be able to change MainSomething. I don't want to use a switch statement or a virtual function or a pointer to a function due to performance and readibility issues.
Basically I would like to be able to make the top and bottom parts a macro as I seem to remember some code used for scripting that did something similar but can't remember quite how it worked. I tried using a multi-line macro but just got compilation errors.
Does anyone have any other ideas?
Code: Select all
s32 numPasses = 1;
if( something )
numPasses = 2;
for(int i=0; i<numPasses; i++ )
{
if( i == 1 )
DoSomething();
MainSomething();
}
Basically I would like to be able to make the top and bottom parts a macro as I seem to remember some code used for scripting that did something similar but can't remember quite how it worked. I tried using a multi-line macro but just got compilation errors.
Does anyone have any other ideas?