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.


FYI:

On MinGW inttypes.h is present and correctly defines all 64 bit formats according to MS proprietary MSVCRT.
On MSVC is missing (as usual ...), but this is not a problem.
On Cygwin inttypes.h seems to be missing, and this is very strange.
On my Debian Woody it's present (of course ... ).


Robert: There is some related stuff in autoconf ?

Regards

Guido



-
========================================================
Guido Serassio
Acme Consulting S.r.l.
Via Gorizia, 69             10136 - Torino - ITALY
Tel. : +39.011.3249426      Fax. : +39.011.3293665
Email: [EMAIL PROTECTED]
WWW: http://www.acmeconsulting.it/

Reply via email to