On Thu, 2011-04-28 at 13:40 +0200, Csaba Halász wrote: [] > NULL has never been officially defined in any C++ header that I know. > So code that relies on that is broken. []
Hi Csaba, It is interesting you say that... do you have a reference? Always interested to learn, know more ;=)) But the 2 simple examples given previously :- // temp1.cxx #include <stdio.h> int main(int argc, char *argv[]) { char * cp = NULL; #ifdef NULL printf("NULL is defined ok\n"); #else printf("NULL is NOT defined\n"); #endif } and // temp2.cxx int main(int argc, char *argv[]) { char * cp = NULL; #ifdef NULL printf("NULL is defined ok\n"); #else // printf("NULL is NOT defined\n"); #endif } Then running g++ on each... ~/test$ g++ temp1.cxx ~/test$ ./a.out NULL is defined ok No problem, then ~/test$ g++ temp2.cxx temp2.cxx: In function ‘int main(int, char**)’: temp2.cxx:4: error: ‘NULL’ was not declared in this scope What am I missing here? ;=)) Does that not indicate NULL is defined in <stdio.h>, or in another header included by it, or do you not consider this a C++ header? Or something... In libio.h, included by stdio.h, I can see a block :- #ifndef NULL # if defined __GNUG__ && \ (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)) # define NULL (__null) # else # if !defined(__cplusplus) # define NULL ((void*)0) # else # define NULL (0) # endif # endif #endif Just to understand... Regards, Geoff. PS: ~/test$ g++ --version g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3 ------------------------------------------------------------------------------ WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel