Removing (HANDLE)NULL casts (2)
Francois Gouget
fgouget at free.fr
Sun Jan 5 02:35:48 CST 2003
On Sun, 5 Jan 2003, Dimitrie O. Paun wrote:
> On January 4, 2003 10:28 pm, Francois Gouget wrote:
> > A few handle types escaped the script the first time around. So here is
> > an updated version that will catch them. The updated version will also
> > catch casts of NULL to LP{C,W,wC}STR and LPVOID.
>
> Why not just use 0 instead of NULL? Does it make any difference?
For the C/C++ compilers it does not make a difference, but to me it does
(maybe because I've used languages with stronger typing than C a lot).
For me 0 is an integer and thus it is wrong to assign it to a pointer.
The compiler agrees with me for all non-zero integers but makes an
exception for 0; 'for convenience's sake', or perhaps for historical
reasons. NULL is a pointer so that's the right thing to use to
initialize a pointer.
Similarly I prefer '\0' to 0 even if the compiler does not care.
--
Francois Gouget fgouget at free.fr http://fgouget.free.fr/
Linux: Because rebooting is for adding new hardware
More information about the wine-devel
mailing list