Subject: Re: How to format u_int64_t on sparc64?
To: NetBSD-current Discussion List <current-users@NetBSD.ORG>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: current-users
Date: 02/27/2003 12:27:23
On Thu, Feb 27, 2003 at 02:43:47PM -0500, Greg A. Woods wrote:

 > > printf("%" PRIu64 "\n", var_u64);
 > 
 > <heavy sarcasm> Oh, please, that _can't_ be right (and it sure looks
 > ugly too!).  Magic strings to generate a printf() specifier for print a
 > fixed-width integer?  </heavy sarcasm>
 > 
 > C99 has definitely gone completely to the dogs.

Considering that what I said *is* the standard-blessed way of doing it,
your proposed solution is wrong.  NetBSD prefers standard-blessed ways
of doing things, where possible.

PS. I don't particular care what you happen to think of C99.

 > Meanwhile casting to an explicit basic integer type that's sure to be at
 > least as wide as the value to be formatted and then just using the
 > proper explicit format specifier for that basic integer type will also
 > obviously work too, just as good C programmers have been doing for time
 > immemorial:
 > 
 > 	printf("%llu", (unsigned long long) var_u64);

You mean GNU C programmers -- "unsigned long long" is not a C89 type.

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>