This is not my exact issue, but an example is as follows
// Method 1
#define Function(argument) (StupidLongArray[argument] + OtherStupidLongArrayName[argument] * WhyAreMyNamesSoLong[argument])
or, prefered
// Method 2
#define _SLA StupidLongArray
#define _OSLAN OtherStupidLongArrayName
#define _WAMNSL WhyAreMyNamesSoLong
#define Function(argument) (_SLA[argument] + _OSLAN[argument] * _WAMNSL[argument])
#undef _SLA
...
...
My understanding of these preprocessor directions implies that once Function has been defined, I can get rid of _SLA and friends. This is not the case.
How come? Is their a way around it?
Unfortunately, there's no way around this. Preprocessor processing basically involves substituting the macro into the original line, then reprocessing it again. So if you call Function(x)
, it becomes (_SLA[x] + _OSLAN[x] * _WAMNSL[x])
first, then the _SLA
, _OSLAN
, and _WAMNSL
macros are substituted afterward. If they're not defined at the place where this substitution occurs, they'll be left as is.