Removing (HANDLE)NULL casts (2)

David Laight david at l8s.co.uk
Sun Jan 5 12:54:24 CST 2003


> Zero is fundamentally built into the language so deep, that playing
> with tricks like NULL and '\0' seem like a waste of time.

FWIW I agree.

In C the character '0' appearing in a source file is the correct
denotation for a 'null' pointer even when the bit-pattern for
a null pointer isn't all zeros.

ie the value assigned by 'ptr = 0;' could be different from
that generated by 'int i = 0; ptr = (void *)i;'

Similarly 'if (ptr) ...' and 'if (!ptr) ...' are valid checks
for a null pointer, save 8 bytes on the line and stop the
(usually) erronous 'if (ptr = NULL) ...'.

	David

-- 
David Laight: david at l8s.co.uk



More information about the wine-devel mailing list