Boost logo

Boost :

Subject: Re: [boost] [units] gcc warnings
From: Jürgen Hunold (juergen.hunold_at_[hidden])
Date: 2010-06-15 09:21:22


Hi,

On Tuesday, 15. June 2010 12:55:37 you wrote:
> Jürgen Hunold wrote:

> > Patch using an explicit static_cast<int> for the return value
> > attached.
>
> Do you know that the long int value can never exceed the range of int? If
> not, the static_cast will simply mask the problem. It would be better to
> check against std::numeric_limits<int>::max() before casting, and resort
> to an exception if the range is exceeded.

So I looked up ios.iword at stdcxx.apache.org and found

long& iword(int idx);

So the best probably would be to return a "long" value.

But I think the author should know best ;-)

Yours,

Jürgen

-- 
* Dipl.-Math. Jürgen Hunold       ! Ingenieurgesellschaft für 
* voice: ++49 511 262926 57       ! Verkehrs- und Eisenbahnwesen mbH  
* fax  : ++49 511 262926 99       ! Lister Straße 15
* juergen.hunold_at_[hidden]        ! www.ivembh.de
* 
* Geschäftsführer:                ! Sitz des Unternehmens: Hannover
* Prof. Dr.-Ing. Thomas Siefer    ! Amtsgericht Hannover, HRB 56965
* PD Dr.-Ing. Alfons Radtke       !

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