Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Sep 1997 15:53:28 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        mike@smith.net.au, perhaps@yes.no
Cc:        cvs-all@FreeBSD.ORG, cvs-committers@FreeBSD.ORG, cvs-gnu@FreeBSD.ORG, jonny@coppe.ufrj.br, phk@FreeBSD.ORG
Subject:   Re: cvs commit: src/gnu/usr.bin/as/config atof-ieee.c src/gnu/usr.bin/ld/rtld rtld.c src/gnu/usr.bin/man/man man.c
Message-ID:  <199709210553.PAA20728@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
><C LAWYER>((void*)0) is a correct definition of NULL.  The other
                                                            ^^^^^another
>correct definition is 0.</C LAWYER>

Other correct definitions:

	0L		/* This has a different type than plain 0.
			 * It may be useful for hiding bugs on machines
			 * where sizeof(long) == sizeof(void *) &&
			 * sizeof(int) < sizeof(void *), and for finding
			 * bugs on machines where sizeof(long) >
			 * sizeof(void *).
			 */
	0UL		/* A weirder type.  This may be useful for
			 * finding misuses of NULL in integer context
			 */
	(2 + 2 != 4)	/* A gratuitously complicated constant integral
			 * expression with value 0.  This definition is
			 * not useful.
			 */
	(sizeof(char) - (int)1.1)
			/* A gratuitously complicated not-obviously
			 * constant integral expression with value 0.
			 * This definition is not useful.
			 */

	Any of the above cast to `void *'.
			/* Such definitions are just silly ways of writing
			 * ((void *)0), since they all have the same type
			 * and value.
			 */

Other not-quite correct definitions:

	0LL		/* Will probably be correct in C9X, since C9X has
			 * long long (blech), and may already be correct
			 * in Gnu C.  This may be useful for hiding bugs
			 * on machines where sizeof(long long) ==
			 * sizeof(void *) && sizeof(long) < sizeof(void *),
			 * and for finding bugs on machines where
			 * sizeof(long long) > * sizeof(void *).
			 */

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199709210553.PAA20728>