Speed of Execution & #directives

trystero49

Prince
Joined
Apr 30, 2012
Messages
515
In making my own .dll I'm using whowards technique of using #preprocessor directives to have two sets of code: one that adds functionality and the original (so that you can easily disable the new code from one header file).

Lets say I have:
Code:
#if defined (MY_MOD)
(Large C++ code block)
#else
(Large C++ code block2)
#end
and MY_MOD is defined. Does the size of Large C++ code block2 affect the speed at which my code works? I assume not, because I told the preprocessor to effectively ignore it. But I'm a total beginner at coding, so I could be wrong. Could someone shed some light on this?

Another, less pressing question, I suppose, is whether or not this is good coding style.
 
Yes, the ignored block is removed and never makes it into the DLL.

And yes, it is good coding style. Being able to undo changes easily is important when you have no idea what you're doing. ;)
 
Yes, the ignored block is removed and never makes it into the DLL.

And yes, it is good coding style. Being able to undo changes easily is important when you have no idea what you're doing. ;)

Thanks for the help. I'm actually using this method with your range 3 bugfix, by copy-pasting your code into my source with #directives so I can go through them both and decide which I like better.
 
Top Bottom