s.huelswitt@xxxxxx (Stefan Huelswitt) wrote: > On 07 May 2006 Clemens Kirchgatterer <clemens@xxxxxxxx> wrote: > > s.huelswitt@xxxxxx (Stefan Huelswitt) wrote: > > > >> Well, normaly NULL is defined as (void *)0, which is a pointer... > > > > only in C. in C++ NULL == 0. > > > > stddef.h: > > > > #ifndef __cplusplus > > #define NULL ((void *)0) > > #else /* C++ */ > > #define NULL 0 > > This cannot be true. > > If NULL == 0 for C++ it should make no difference, but gcc4 complains > with 0 but not with NULL. So there is a differnce. no. the prototyp of the function in question is: unistd.h: extern int execle (__const char *__path, __const char *__arg, ...) so the compiler really has no clue what the type of the ... args should be. the reason for the warning and now i can only guess, as i'm to lazy to look up the code, comes from some compiler dependent, maybe broken variable argument type checking. try the following test program (compile with g++ -Wall test.cpp) : #include <cstdio> void bar(char *baz) { } int main(int argc, char **argv) { char *foo = NULL; printf("%s", foo); printf("%s", NULL); printf("%s", 0); bar(foo); bar(NULL); bar(0); return (0); } my compiler (g++ 3.3.6) throws warnings at the printfs with NULL and 0, though it shouldn't. the calls to bar() are completely legal and do not bother him (rightly). there is really no differnce between 0 and NULL in C++ and its usage is a matter of taste. the warnings gcc 4 throws on this variable arguments list are, IMHO, weaknesses in its vargs typechecking and i would not work around it. best regards ... clemens