Boost logo

Boost :

Subject: [boost] [preprocessor] macro #definition order
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2010-09-21 08:35:34


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

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk