Subject: Re: How to format u_int64_t on sparc64?
To: None <email@example.com>
From: Greg A. Woods <firstname.lastname@example.org>
Date: 02/27/2003 14:43:47
[ On Thursday, February 27, 2003 at 06:53:52 (-0800), Jason R Thorpe wrote: ]
> Subject: Re: How to format u_int64_t on sparc64?
> On Thu, Feb 27, 2003 at 10:41:49AM +0100, Juergen Hannken-Illjes wrote:
> > What is the right way to printf an u_in64_t value?
> 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.
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
printf("%llu", (unsigned long long) var_u64);
And of course there's still always the option of using an explicit
function, or just a simple little mod loop, to convert an integer to a
string and then just print the string. :-)
Greg A. Woods
+1 416 218-0098; <email@example.com>; <firstname.lastname@example.org>
Planix, Inc. <email@example.com>; VE3TCP; Secrets of the Weird <firstname.lastname@example.org>