[comp.std.c] Commas in macro arguments

ct@dde.dk (Claus Tondering) (03/23/90)

Suppose I have the following macro definition:

#define call(a,b)	a(b)

I can use that to call a function with one argument. How can I use
it to call a function with two arguments? In other words: How do I
pass a string containing a comma as the second argument to the macro?
Can it be done, or is it impossible?
-- 
Claus Tondering
Dansk Data Elektronik A/S, Herlev, Denmark
E-mail: ct@dde.dk    or    ...!uunet!mcvax!dkuug!dde!ct

peter@ficc.uu.net (Peter da Silva) (03/26/90)

> >#define call(a,b)	a(b)

> >I can use that to call a function with one argument. How can I use
> >it to call a function with two arguments? In other words: How do I
> >pass a string containing a comma as the second argument to the macro?

> You can't.

Sometimes you can, depending on how much you want to munge the arguments:

#define call(a,b) a b

call(a,(b))
call(c,(d,e))
-- 
 _--_|\  `-_-' Peter da Silva. +1 713 274 5180. <peter@ficc.uu.net>.
/      \  'U`
\_.--._/
      v