This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC headers and DJGPP port
- To: law at cygnus dot com
- Subject: Re: GCC headers and DJGPP port
- From: Phil Edwards <pedwards at disaster dot jaj dot com>
- Date: Sat, 22 Jul 2000 16:29:42 -0400
- Cc: djgpp-workers at delorie dot com, eliz at is dot elta dot co dot il, gcc at gcc dot gnu dot org, martin at loewis dot home dot cs dot tu-berlin dot de, mrs at windriver dot com
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