Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: printf format question



In message <Pine.NEB.4.64.1012251909130.22911%quicky.whooppee.com@localhost>, 
Paul Goyette writes:
>I know I'm mising something totally basic and obvious, but what format 
>specifier should I use when printing a variable of type clock_t ?

Don't know!

>On amd64, a clock_t is typedef'd to "unsigned int" and printf %u works 
>fine.  But on i386, clock_t is typedef'd to "unsigned long" and requires 
>printf %lu, and both %u and %llu fail to compile.  There doesn't seem to 
>be any entry in i386/int_fmtio.h that equates to %lu

>So, what is the correct printf format to use?

I don't know!  I know there's some crazy stuff for formats for things
like int8_t in C99, but I don't know that this was ever done for clock_t.

I'd probably cast the clock_t to some specific type, so, I'd use
%llu and (usigned long) foo.

-s


Home | Main Index | Thread Index | Old Index