[net.unix-wizards] Please use NULL instead of 0 wheneve

rpw3@fortune.UUCP (02/08/84)

#R:ttds:-15100:fortune:11600057:000:582
fortune!rpw3    Feb  7 20:05:00 1984

We have here the argument between

	1. The "right" way -- cast the pointer as an arg
	2. The "easy" way -- cast the pointer as a define

may I suggest

	3. The "easy/right" way -- define a NULL for each type, as in

	#define	NULL		0
	#define	NULLint		(int)	  NULL
	#define	NULLchar	(char)	  NULL
	#define	NULLxyz_type	(xyz_type)NULL

Then
	val = foo(x, y, NULLchar, z);

Isn't that easy to type? (**groan**)	:-)

Rob Warnock

UUCP:	{sri-unix,amd70,hpda,harpo,ihnp4,allegra}!fortune!rpw3
DDD:	(415)595-8444
USPS:	Fortune Systems Corp, 101 Twin Dolphins Drive, Redwood City, CA 94065

rpw3@fortune.UUCP (02/08/84)

#R:ttds:-15100:fortune:11600060:000:602
fortune!rpw3    Feb  7 20:11:00 1984

We have here the argument between

	1. The "right" way -- cast the NULL pointer when used as an arg
	2. The "easy" way -- cast the NULL pointer as a define

may I suggest

	3. The "easy/right" way -- define a NULL for each type, as in

	#define	NULL		0
	#define	NULLint		(int)	  NULL
	#define	NULLchar	(char)	  NULL
	#define	NULLxyz_type	(xyz_type)NULL

Then
	val = foo(x, y, NULLchar, z);

Isn't that easy to type? (**groan**)	:-)

Rob Warnock

UUCP:	{sri-unix,amd70,hpda,harpo,ihnp4,allegra}!fortune!rpw3
DDD:	(415)595-8444
USPS:	Fortune Systems Corp, 101 Twin Dolphins Drive, Redwood City, CA 94065

edhall%rand-unix@sri-unix.UUCP (02/10/84)

From:  Ed_Hall <edhall@rand-unix>

Why clutter things with #define's?  It doesn't take much more typing
to say:

		(type *)NULL

where NULL is #define'd to 0.  And it is about as clear as you can get.

		-Ed Hall
		edhall@rand-unix        (ARPA)
		decvax!randvax!edhall   (UUCP)