| shihan (3) | |
|
In the library "stddef.h" I find out this line of code: #if defined (_STDDEF_H) || defined (__need_NULL) #undef NULL /* in case <stdio.h> has defined it. */ #ifdef __GNUG__ #define NULL __null #else /* G++ */ /* shield NULL definition for non-gnu parsers */ >>new<< #ifndef __cplusplus >>new<< #define NULL ((void *)0) >>new<< #else >>new<< #define NULL 0 >>new<< #endif /* __cplusplus */ #endif /* G++ */ #endif /* NULL not defined and <stddef.h> or need NULL. */ #undef __need_NULL as you can see NULL is defined as __null. My question is this: where is __null defined? | |
|
|
|
| Disch (8349) | |
|
It might be defined by the compiler. Double underscores in front usually indicate a compiler-specific keyword. The fact that it's within a compiler #ifdef also suggests that. Though in C++11 you don't really need NULL or __null because there's a standard nullptr keyword that is widely implemented.
| |
|
|
|
| shihan (3) | |
| Hmm got it. Thanks you very much:) | |
|
|
|
| shihan (3) | |
|
By the way if I wanna see the code of the compiler (to find out the declaration of the __null) , where do i have to look at? p.s. I'm curious | |
|
Last edited on
|
|