Warning for unadorned 0 in varargs lists?

Eddie Kohler kohler@icir.org
Fri Aug 20 01:11:00 GMT 2004


>> This would generate the minimum number of false positives, but 
>> wouldn't
>> catch a bunch of errors, or errors on most user functions.  I'd be
>> happy even with a version of the warning that required me to write
>> "(int) 0" when I meant the integer zero (in varargs lists only).
>
> But if the attribute approach were followed, the user can add her own
> attributes to do checking for execl-like functions.  This is already
> easily done for nonstandard printf-like functions.

Yes, the attribute approach is better.  But the particular function 
that's giving me problems has a "type" like
    int (*)(void*, int, int, [const char*, int]*, const char* = 0)
so it's not execl-like.

An attribute that said "the last argument must be a pointer", as 
Florian Weimer suggests, *would* work.



More information about the Gcc mailing list