
Conditional Compilation Straddling Function Definitions

kravlor
Conditionals must be either completely outside or completely inside function definitions; they cannot straddle a function definition.
I would appreciate the ability to have conditional compilation straddle function definitions.
Motivation: I am in the process of debugging a large codebase of interdependent ThreadSafe functions. It would be very handy to be able to remove the ThreadSafe declaration from them all with a #define setting, enabling the Igor debugger.
Example code using wished-for feature:
#define USETHREADSAFE #if USETHREADSAFE ThreadSafe Function myFunc(var, str) #else Function myFunc(var, str) #endif Variable var String str // Function body End
I'm sure others could come up with more clever uses, too.
As far as conditional compilation straddling function definitions, I can see it being useful, but it would come at a cost: development time that could be better spent elsewhere.
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
August 10, 2010 at 05:44 pm - Permalink