??? 06/30/05 19:30 Read: times Msg Score: +1 +1 Good Answer/Helpful |
#96335 - In context Responding to: ???'s previous message |
Abhishek Singh said:
in previous posts, Andy stated:
The preprocessor has no business doing any maths at all: I said it here; that's true. But your example was #if constant_expression <code> #else <code> #endifI was talking about #define Xtal 22.1184 #define tic12 (12/Xtal) #define _10msec (65536 - ((1000 * 10) / tic12)) Now, clearly, the preprocessor does have to evaluate the constant_expression in your example in order to test the condition - but such expressions are restriced to integer-only maths (among other things). But the #define macro names are different: as far as the preprocessor is concerned, anything that comes after the macro name is just treated as pure text; the preprocessor does not even know that they are expressions - let alone try to evaluate them! All the preprocessor does with these definitions is to replace every occurrence of the macro name with whatever followed it on the definition line. No maths! So yes, I missed the distinction between the two cases - what I said applies to the latter. |