On May 10, 1:33 am, Andre Poenitz <poen...@[EMAIL PROTECTED]
> wrote:
> Paul <-...@[EMAIL PROTECTED]
> wrote:
> > I would like to define a list of parameters, and then pass them to a
macro.
> > However, the compiler (gcc) only sees one parameter, rather than
expanding
> > the definition.
> > Could anyone suggest a way of making this work (using the
preprocessor)?
>
> > #define MyList 1,2,3,4
>
> > #define Sum(a,b,c,d) a+b+c+d
>
> > x = Sum(MyList);
>
> Something like
>
> #define LIST 1,2,3,4
>
> #define SUMX(a,b,c,d) (a+b+c+d)
> #define SUM(a) SUMX(a)
>
> x = SUM(LIST);
>
> might help.
>
> Andre'
> --
> comp.lang.c.moderated - moderation address: c...@[EMAIL PROTECTED]
-- you
must
> have an appropriate newsgroups line in your header for your mail to be
seen,
> or the newsgroup name in square brackets in the subject line. Sorry.
Hm. Could you explain this please? Why it works?
--
comp.lang.c.moderated - moderation address: clcm@[EMAIL PROTECTED]
-- you must
have an appropriate newsgroups line in your header for your mail to be
seen,
or the newsgroup name in square brackets in the subject line. Sorry.


|