Boost logo

Boost :

From: Samuel Krempp (krempp_at_[hidden])
Date: 2002-06-17 12:32:22


On Wed, 2002-06-05 at 20:10, Dan Gohman wrote:

> Second, there are some issues with LP64 platforms. One one of the
> platforms I'm using right now, pointers, longs, and unsigned longs
> are 64-bit types. Additionally, size_t, ptrdiff_t, and streamsize
> are typedefed to 64-bit types.
>
> Here are the (reformatted) warnings that I'm currently seeing from the
> format library. Some of these look like they can be fixed by using
> std::streamsize instead of int.

right !

I modified the source so that types should be correct independantly of
the platform.

it compiles with both gcc 3.1 and MSVC, but I can only test with my own
i386 machine..
Can you tell me if the new code in CVS compiles without those warnings
on your platform ?

I need to cast streamsize to size_t here and there, and also to signed
types; I assume there is no reason to worry about wrap-around problems
since it's quite impossible to reach 2^31 arguments..

But by the way, does boost provide functions for integral types
conversion that checks against over-limit numbers ?
or is there a std:: way to do it, that I don't know ?
for instance, I'm always uncomfortable casting an unsigned to signed.
Taking the habit of static_cast'ing types without checking for possible
over-limit problems can cause unnecessary risks of obscure failures,
sooner or later, when we do reach the limit..

-- 
Samuel

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