[Xorp-hackers] PATCH: Logging improvements, fix artificial deal for xorpsh commit.

Ben Greear greearb at candelatech.com
Wed Oct 7 09:51:03 PDT 2009


On 10/07/2009 01:36 AM, Bruce Simpson wrote:
> Ben Greear wrote:
>>
>> Will add an #ifdef that could be twiddled in scons.
>
> Excellent...
>
>>
>>> * %llu is not a portable format specifier, and 'unsigned long long' is
>>> not a portable type, please don't use them in portable code.
>>
>> Ok, I can use uint64_t, but what do you use instead of %llu to print it?
>
> %j and intmax_t is ISO C99 portable. It sucks because it means casting
> to the widest integer type on the platform, but it's a known quantity.
> 'long long' has been a problem since well before Sun brought out SPARCV9.

 From MS's page, they may not support %j (or %ll for that matter).  Maybe
the just don't document it:

http://msdn.microsoft.com/en-us/library/hf4y5e3w%28VS.71%29.aspx

Anyway, I think I'll leave it %llu for now.  It's not the end of the world if
some obscure platform uses something other than a 64-bit value for this,
and if it breaks compile due to snprintf limitations on some platform,
can fix it then with #ifdef or some other kludge.

(Using uint64_t and %llu is a compile warning for F11, 64-bit, btw,
but unsigned long long and %llu works fine on 32 and 64 bit.)

Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



More information about the Xorp-hackers mailing list