Hi Henrik,

At 02.16 13/03/2005, Henrik Nordstrom wrote:

On Sat, 12 Mar 2005, Serassio Guido wrote:

Again Henrik, what about to use the PRIxxxx macros defined in inttypes.h ?

After some consideration I think I'll settle for the following

#if SIZEOF_LONG < 8 && defined(PRId64) && defined(INT64_MAX) && HAVE_STRTOLL
typedef int64_t squid_off_t;
#  define SIZEOF_SQUID_OFF_T SIZEOF_INT64_T
#  define PRINTF_OFF_T PRId64
#  define strto_off_t (int64_t)strtoll
#else
typedef long squid_off_t;
#  define SIZEOF_SQUID_OFF_T SIZEOF_LONG
#  define PRINTF_OFF_T "ld"
#  define strto_off_t strtol
#endif

If the platform doesn't have inttypes.h with it's defined printf format specifier then the support for 64 bit types is probably a bit sketchy and better fall back on plain long.

I agree, more conservative.

For Windows you can clean up the types in include/squid_types.h if needed

typedef __int64_t int64_t;
#define PRId64 "I64d"
#define INT64_MAX 0x7FFFFFFFFFFFFFFFLL

From limits.h of MS Visual Studio:

/* minimum signed 64 bit value */
#define _I64_MIN    (-9223372036854775807i64 - 1)
/* maximum signed 64 bit value */
#define _I64_MAX      9223372036854775807i64
/* maximum unsigned 64 bit value */
#define _UI64_MAX     0xffffffffffffffffui64

They use the "i64" suffix instead of "LL" .....

No comment .... :-(

So I will have:

typedef __int64 int64_t;
#define PRId64 "I64d"
#define INT64_MAX _I64_MAX

Regards

Guido



-
========================================================
Guido Serassio
Acme Consulting S.r.l. - Microsoft Certified Partner
Via Lucia Savarino, 1           10098 - Rivoli (TO) - ITALY
Tel. : +39.011.9530135  Fax. : +39.011.9781115
Email: [EMAIL PROTECTED]
WWW: http://www.acmeconsulting.it/



Reply via email to