trafficserver-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mladen Turk <mt...@apache.org>
Subject Re: stdint.h
Date Wed, 19 May 2010 04:15:41 GMT
On 05/19/2010 02:52 AM, John Plevyak wrote:
>
>
> Why the hell uint64_t is defined this way and g++ complains even
> though long int == long long it is beyond me.
>
> Suggestions, comments?
>

I saw whole bunch of %ld, %lld stuff in the code which will IMHO
never be portable no matter what type you use.

With APR (and some other projects) we detect those types
at configure time, and define printf/scanf macros
eg. apr_int64_t, apr_uint64_t and then have
APR_INT64_FMT_T, and APR_UINT64_FMT_T

This makes printf/scanf code a little bit longer:
eg. printf("Use some %" APR_UINT64_FMT_T " 64-bit integer\n", (apr_uint64_t)foo);
but it is portable, especially between 32 and 64 bit compilers

Think we should use something like that, because we already
have the detection code (from other projects) and it works well
for a variety of different compilers.

At the end it's more or less discipline and search/replace,
and I was going to add them anyhow.


Regards
-- 
^TM

Mime
View raw message