This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: patch/rfc: A better way to do variadic functions


Zack Weinberg wrote:-

> In the shower this morning, it dawned on me how to get around that.

I seem to recall this isn't your first inspiration born in the shower
:-)

> This patch creates some new ansidecl.h macros which let us write
> 
> void
> error VPARAMS ((const char *msgid, ...))
> {
>   diagnostic_context dc;
>   VA_OPEN (ap, msgid);
>   VA_FIXEDARG (ap, const char *, msgid);
> 
>   /* body of function */
> 
>   VA_CLOSE (ap);
> }
> 
> which is a third the size, easier to read, and clearer as to what's
> going on.  You can put the declaration of diagnostic_context after the
> VA_FIXEDARG call(s) if you like, too.

Looks good to me at least, Zack.

Neil.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]