This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Warning for unadorned 0 in varargs lists?
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.
But if there is such a prototype in scope, then a literal 0 argument will
be cast to a const char*, even on a platform with 32-bit int and 64-bit
pointers. So what is the problem? Does your code omit the prototype
altogether and hope that the right thing happens?
Oh, misunderstanding. The function takes any number of [const char*, int]
pairs, followed by a null pointer. Thus "[const char*, int]*" regex syntax.
Sorry, should have been more clear.
The actual prototype is
int Clp_AddStringListType(Clp_Parser *, int type_id, int flags, ...);
Uses include
Clp_AddStringListType
(clp, LOOP_TYPE, Clp_AllowNumbers,
"infinite", 0, "forever", 0,
(const char*) 0);
Clp_AddStringListType
(clp, DISPOSAL_TYPE, Clp_AllowNumbers,
"none", GIF_DISPOSAL_NONE,
"asis", GIF_DISPOSAL_ASIS,
"background", GIF_DISPOSAL_BACKGROUND,
"bg", GIF_DISPOSAL_BACKGROUND,
"previous", GIF_DISPOSAL_PREVIOUS,
(const char*) 0);
Eddie