This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: GCC headers and DJGPP port



Jeffrey A Law <law@cygnus.com>:
> Let's take the __null issue again.  According to the C++ standard it is
> an implementation-defined C++ null pointer constant -- it also states
> that (void *)0 is not an acceptable value.
>
> It turns out that using "0" doesn't work, nor does "0L" for reasons I
> can't remember.

Overloading based on the distinction between pointer and integer becomes
impossible, or a freakish nightmare at best.  If you pass in "NULL",
you'd expect the compiler to choose the pointer version, but if it's 0 a
compiler will -- quite correctly -- choose the integer version.

With 0L you can at least hope to get an ambiguity warning.  Sometimes.
Except if the overloaded function takes a long integer, then you're
screwed again.

Having __null magically only match pointer types is an extremely froody
solution, and I'm glad that g++ went that route.


Phil


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]