Re: [PATCH] Replace NULL symbol with 0
- From: Dodji Seketeli <dodji seketeli org>
- To: The mailing list of the Nemiver project <nemiver-list gnome org>
- Subject: Re: [PATCH] Replace NULL symbol with 0
- Date: Thu, 04 Aug 2011 21:33:38 +0200
"Tomasz Kupczyk" <kupczyk tomasz gmail com> a écrit:
> When is NULL not necessarily correct? I suppose it's better to read
> some rationale why nullptr is introduced :)
For instance:
#define NULL (void*)0
void foo(const char*);
void
bar()
{
foo(NULL);
}
The GNU C compiler compiles this just fine, whereas the GNU C++ compiler
does not, because you can't cast a void* into a char*.
This is a case of a valid C definition of NULL, which is not valid in
C++.
--
Dodji
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]