Boost logo

Boost :

Subject: Re: [boost] [config] polygon library long long, long double portability
From: Bo Persson (bop_at_[hidden])
Date: 2009-06-26 06:48:11


Simonson, Lucanus J wrote:
> Steven Watanabe wrote:
>> AMDG
>>
>> Simonson, Lucanus J wrote:
>>> I use long long and long double in the configuration of my integer
>>> arithmetic traits. I'd like to guard those usages with boost
>>> macros to allow the code to compile on platforms that don't
>>> support long long and long double (replace with long and double
>>> respectively) but I can only find a BOOST_HAS_LONG_LONG macro
>>> (which is apparently not documented) and not a corresponding
>>> BOOST_HAS_LONG_DOUBLE. Is there some other macro I can use to
>>> detect BOOST_HAS_LONG_DOUBLE or a typedef I can use that is
>>> already set to long double if available and double otherwise?
>>>
>>
>> long double is standard C++. long long is only the
>> the new standard.
>>
>> You might also consider using boost::int64_t from
>> boost/cstdint.hpp guarded by BOOST_NO_INT64_T
>>
>> msvc has 64 bit ints, but doesn't call them long long.
>>
>> In Christ,
>> Steven Watanabe
>>
> 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.

Later versions of MSVC actually have long long (as well as their own
__int64). They behave like a typedef for each other, so are
interchangeable.

Bo Persson


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk