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.

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

and similarily support for other platforms can be added there on a case by case basis.

Regards
Henrik

Reply via email to