This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: preprocessor: % as args to #defines
- From: Michael Matz <matz at suse dot de>
- To: Ralf Corsepius <corsepiu at faw dot uni-ulm dot de>
- Cc: GCC List <gcc at gcc dot gnu dot org>
- Date: Thu, 29 Jan 2004 15:58:04 +0100 (CET)
- Subject: Re: preprocessor: % as args to #defines
- References: <1075376998.3801.20866.camel@mccallum.corsepiu.faw.uni-ulm.de>
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.