Boost logo

Boost Users :

Subject: [Boost-users] PP: is macro expansion cached?
From: Hicham Mouline (hicham_at_[hidden])
Date: 2010-02-12 17:10:09


Hello,

 

Say I define a macro

 

#define MYMACRO(x,y) ..

 

MYMACRO because of various reasons takes very long to expand (1mn) (uses
PP_FOR, PP_WHILE, PP_SEQ_FOR_EACH .).

 

If later in the translation unit, I have a "call" to MYMACRO

 

MYMACRO(a,b)

and then a couple of lines later

MYMACRO(a,b)

 

Will it be faster to define

line 15: #define MYMACRO_ab MYMACRO(a,b)

and then use

 

line 25: MYMACRO_ab

.

line 35: MYMACRO_ab

 

 

When does MYMACRO expansion happen?

Is it at line 15 once, or at lines 25 and 35?

Is the answer compiler-dependent?

 

Regards,



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net