Re: 64 bit printf() format prefix compatibility problem

From: Robert Collins <robertc@dont-contact.us>
Date: 11 Aug 2003 22:44:55 +1000

On Sun, 2003-08-10 at 22:01, Serassio Guido wrote:
> Hi Alan,
>
> At 13.14 10/08/2003, Alan Barrett wrote:
>
> >On Sun, 10 Aug 2003, Serassio Guido wrote:
> > > gcc uses "ll" as 64 bit formatting prefix for printf, where MSVC uses
> > "I64".
> >
> >In C++, as Robert said, using operator<< would be better.
> >
> >In standard C (C99), the way to handle this is to include <inttypes.h>
> >to get definitions of PRId64 and friends. Then you do stuff like this:
> >
> > int64_t foo;
> > printf("foo=%"PRId64"\n", foo);
> >
> >If your compiler or system library doesn't supply the PRIxxx macros that
> >are supposed to be in <inttypes.h>, then you could define them somewhere
> >conditional on the compiler or system.
>
> This seems to me a very good approach.

I think it's simpler just to leave it for now, and put a C++ operator in
place for squid-3.1.

Cheers,
Rob

-- 
GPG key available at: <http://members.aardvark.net.au/lifeless/keys.txt>.

Received on Mon Aug 11 2003 - 06:44:23 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:20:28 MST