Bill Allombert on Fri, 18 Sep 2009 10:42:37 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Static analyzer run


On Fri, Sep 18, 2009 at 07:40:37AM +0200, Lorenz Minder wrote:
> Hi,
> 
> KB:
> > * Bill Allombert [2009-09-16 12:46]:
> > > Commited in revision 11921. I find very unfortunate that gerepileall 
> > > take an explicit argument number. I was hopping for some preprocessing
> > > trickery to avoid that, but I found none.
> > 
> > Neither did I when I orignally implemented it.
> 
> C89 does not have variadic macros, so I think it's unlikely this can be
> done in C89.
> 
> But in the context it may be worth pointing out that users of libpari
> who do not care for C89 compatibility can use C99's __VA_LIST__ for this
> if they want the convenience.
>    
> #define gerepileall_a(av, ...) \
>   gerepileall(av, sizeof((GEN*[]){__VA_LIST__})/sizeof(GEN*), __VA_LIST__)

Nice trick! At least we can use it in test-build, to check whether n
match the actual number of argument...

Unfortunately the idiom 
gerepileall(av, A?2:1,A,B);
has become very common.

An unrelated issue is that gerepileall() does not call va_end

Cheers,
Bill.