Boost logo

Boost :

Subject: Re: [boost] [config] polygon library long long, long double portability
From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2009-06-26 12:40:02

John Maddock wrote:
>>> msvc has 64 bit ints, but doesn't call them long long.
> Yes it does, at least with current versions :-)

I don't compile in old versions of MSVC for a number of reasons, and only test with MSVC9. I guess for my purposes MSVC does have 64 bit long long.

>> Yes, I realized that long double must be standard after grepping the
>> boost codebase and seeing it used everywhere. If we searched the
>> archive we'd probably find I asked this same question in the past.
>> I might be a slow learner. My code with long long compiles in MSVC,
>> does is compile to a 32 bit int? Specifying int64_t would make
>> sense if my integer coordinate traits were in terms of int32_t, but
>> they are in terms of int. Perhaps I should change that as well.
> Please don't confuse types, with widths: you need to use either
> specific width types throughout (which are all of unspecified type),
> or use specific types. For example code that needs to overload a
> function for all the integer *types* would use long long where
> available, where as code that's designed to work with specific
> *widths* should use the boost::intXX_t types throughout, in the
> knowledge that these may not cover all the available *types* (for
> example if long is a 64-bit int then long long is never used by the
> intXX_t typedefs).
> I hope that's not too confusing :-) Basically decide which set to
> used
> based on what your code does, and what the integers represent.

That is what I'm doing. Currently I define coordinate traits in terms of built-ins and am aware that their widths change from platform to platform. To the greatest extent possible I try to ensure correctness across platforms by (for example) not assuming long is wider than int and using long long instead. I'm debating whether to replace that system completely with one where I am explicit about bit width by using typedefs. I'm inclined to leave things as they are now that I have proper guards around my usage of long long.


Boost list run by bdawes at, gregod at, cpdaniel at, john at