This is the mail archive of the
mailing list for the GCC project.
Re: Problem with macro params containing commas
skaller <firstname.lastname@example.org> writes:
|> On Fri, 2003-08-15 at 02:11, Jean-Eric Cuendet wrote:
|> > Hi,
|> > I'd like to pass params that contains commas to a macro.
|> > But the macro processor think that the passed param is 2 parts (separated by the
|> > inner macro). It's normal, but not what I want...
|> > Is there a way to do it differently?
|> > Thanks
|> > -jec
|> I use:
|> #define comma ,
|> ... offsetof(X<A comma B>,x) ...
In this case you can just put parens around X<A,B>: offsetof((X<A,B>),x).
|> #define MACRO_PARAM_1 <class First,class Second>
|> #define MACRO_PARAM_2 Fn_Pair<First,Second>
|> FN_DEFINE_TEMPLATE_CLASS_METHODS( MACRO_PARAM_1, MACRO_PARAM_2, Fn_Kind,
|> Fn_Pair_CLASS_ID );
|> That doesn't work.
|> gcc says that FN_DEFINE_TEMPLATE_CLASS_METHODS requires 4 parameters ans
|> that 6 are passed!
This can probably be solved as well by adding some (redundant) parens.
For MACRO_PARAM_1 this probably doesn't work directly, but by making it a
function-like macro taking the appropriate parameters it should be easy to
insert the parens at the right place.
Andreas Schwab, SuSE Labs, email@example.com
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."