For storing integers with bitwise operands inside their declaration, which should I use? Performance wise I think that an enumeration works slightly faster, however what's the standard?
Name:
Anonymous2009-03-28 7:03
i would personally use define.
I FUQIN LOVE #define
A #define will be recalculated everytime rather than just a look up. This could account for enum being faster..but I would have thought const would have been the same.
Is it uncommon for you to have 100+ defining statements in your header?
Name:
Anonymous2009-03-28 13:14
>>1 storing integers with bitwise operands inside their declaration
am i envisioning this correctly?
// shift in declaration
#define ONE 1>>1
if so, then i'd use a const int or typedef enum since either of those will enforce ``types-safety''.
Name:
Anonymous2009-03-28 13:41
>>7
No, but you still shouldn't. People should use the pre-processor as little as possible, because
a) it changes the lexical structure of your program and
b) if you have an error and you go into the debugger, debugging the replaced text will be more difficult (that is, if you used a macro function).
Name:
Anonymous2009-03-28 15:20
>>8
Your typedef'd enums don't work so well when you want to combine flags.
Name:
Anonymous2009-03-28 15:20
>>9
Using a preprocessor is the only way to create a new control structure.