Mail Archives: djgpp/2000/04/05/12:15:26
Michael N. Filippov <michael AT idisys DOT iae DOT nsk DOT su> wrote:
> Does anybody know how could i write #define to use it with
> not predefined number of args. Example:
In standard C, as defined in 1989, you can't. The new standard revision,
and GCC as an existing extension, support it, but for those, you've
got the syntax wrong.
> #include <stdio.h>
> #define P(format, s) printf(format, s) // this is for one argument
> #define MP(format, ...) printf(format, ...) // error
Make that line
#define MP(format, ...) printf(format, __VA_ARGS__)
and it may work. Or look up the correct syntax in the GNU cpp manual
('info cpp').
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -