Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] Variable number of args in a #define macro


Variadic macros are not part of the ANSI spec, we haven't fully implemented all of the GCC extensions yet.  
Ref: https://bugs.eclipse.org/bugs/show_bug.cgi?id=39688

JohnC
www.eclipse.org/cdt


cdt-dev-admin@xxxxxxxxxxx wrote on 07/29/2004 08:10:59 PM:

> This syntax doesn't seem to work either, it fails if more than one args is
> passed to the macro :
>
> #define DEBUGL(...) fprintf (stderr, ##__VA_ARGS__)
>
> Or this, it fails if there is only one arg passed into the macro :
>
> #define DEBUGL(format, ...) fprintf (stderr, format, ##__VA_ARGS__)
>
> jmp
>
> > -----Original Message-----
> > From: cdt-dev-admin@xxxxxxxxxxx
> > [mailto:cdt-dev-admin@xxxxxxxxxxx] On Behalf Of J. Matthew Pryor
> > Sent: Friday, July 30, 2004 9:52 AM
> > To: cdt-dev@xxxxxxxxxxx
> > Subject: [cdt-dev] Variable number of args in a #define macro
> >
> > Using CDT 2.0 on Windows XP cygwin, I don't seem to be able
> > to define a variable args macro that the C++ Indexer is happy with
> >
> > The macro definition looks like this:
> > #define DEBUGL(args...) fprintf (stderr, args)
> >
> > The usage like this:
> > DEBUGL("MAIN loopCount %d", loopCount);
> >
> > And the error:
> > C/C++ Indexer Problem: Macro usage error for macro : DEBUGL
> > in file:  main.c on line: 75
> >
> > Is there a way to do this? Should it work?
> >
> > Thanks for any information
> >
> > Matthew
> >
> > _______________________________________________
> > cdt-dev mailing list
> > cdt-dev@xxxxxxxxxxx
> > http://dev.eclipse.org/mailman/listinfo/cdt-dev
> >
>
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/cdt-dev

Back to the top