[preprocessor] macro #definition order

Hello all, I have a curiosity about the preprocessor: In the following example, is there any difference if `CONCAT()` is #defined before or after `CONCAT_D()`? Example 1: #define CONCAT(a, b) CONCAT_D(a, b) #define CONCAT_D(a, b) a ## b Example 2: #define CONCAT_D(a, b) a ## b #define CONCAT(a, b) CONCAT_D(a, b) In other words, are example 1 and 2 completely equivalent? Or, is there is a functional difference (proper expansion order, portability, etc)? Or, is there a performance difference (number of macro expansions, preprocessing time, etc)? I am asking because I would like to understand *in general* if the order in which I #define my macros when I program the preprocessor using Boost.Preprocessor might make a difference either functionally or for performance. Thank you very much. -- Lorenzo

I have a curiosity about the preprocessor: In the following example, is there any difference if `CONCAT()` is #defined before or after `CONCAT_D()`?
Example 1: #define CONCAT(a, b) CONCAT_D(a, b) #define CONCAT_D(a, b) a ## b
Example 2: #define CONCAT_D(a, b) a ## b #define CONCAT(a, b) CONCAT_D(a, b)
In other words, are example 1 and 2 completely equivalent? Or, is there is a functional difference (proper expansion order, portability, etc)? Or, is there a performance difference (number of macro expansions, preprocessing time, etc)?
There is no difference between the two examples - none whatsoever. Regards Hartmun --------------- http://boost-spirit.com
I am asking because I would like to understand *in general* if the order in which I #define my macros when I program the preprocessor using Boost.Preprocessor might make a difference either functionally or for performance.
Thank you very much.
-- Lorenzo _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (2)
-
Hartmut Kaiser
-
Lorenzo Caminiti