This is wrong:#define NULL 0
Know why? In C++, this is supposed to be legal:#define NULL ((void *)0)
char *p = NULL;
With the first version, it is. With the second version, it's an error: there is no legal implicit conversion from void* to char*
<stddef.h>, <libio.h>, <glib/glib.h> -- I'm lookin' at you.
All trademarks and copyrights on this page are owned by their respective owners. Comments are owned by the Poster. The Rest © 1997-2008 SourceForge, Inc.
very good. (Score:1)
Re: (Score:2)
C is a lot more casual about pointer conversion than C++. Here's what I get on my system for
{
$ gcc -c foo.c -Wall
foo.c: in function `foo':
foo.c:3: warning: unused variable `p'
$ g++ -c foo.c -Wall
foo.c: in fun