This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: preprocessor: % as args to #defines


Hi,

On Thu, 29 Jan 2004, Ralf Corsepius wrote:

> -- snip --
> #define CONCAT1(a, b) CONCAT2(a, b)
> #define CONCAT2(a, b) a ## b
> #define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
> -- snip --

One can't use '##' for this anymore.  Normally one would simply delete it, 
but that produces a space (i.e. "% reg").  If that isn't wanted you might 
want to use this:

#define EVAL(x) x
#define CONCAT(x, y) EVAL(x)EVAL(y)
#define __REG__ %
#define REG(x) CONCAT (__REG__, x)
REG(reg)


Ciao,
Michael.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]