Subject: Re: build broken at usr.bin/fstat
To: Ross Harvey <>
From: None <>
List: current-users
Date: 07/16/1998 19:32:56
In message <>, Ross Harvey writes:
>	The problem:

		printf("%d", sizeof something);

>	The compiler issues a warning in 64-bit environments, the reason
>	the warning doesn't always happen:

>		sizeof returns type size_t, which is an int in ILP32,
>		but a long in LP64

It doesn't matter, it's wrong anyway.  It's an *UNSIGNED* int, and,
if we're going to pick nits, it is *not* permissible (in C89, with
the most recent set of rulings, I think) to pass an unsigned anything
to %d.

>		A.  Cast to (void *) and use %p

This is very surprising, and not (IMHO) well defined.

>		B.  Cast to (int) or (unsigned int)

I like this one.

>		C.  Cast to (long) or (unsigned long) and use %ld

I also like this one.

However, if you want to use (unsigned long), use %lu.