Boost logo

Boost :

Subject: Re: [boost] SafeInt code proposal
From: Niels Dekker - address until 2010-10-10 (niels_address_until_2010-10-10_at_[hidden])
Date: 2009-06-21 04:28:41


Omer Katz wrote:
> A friend and I have started working on a SafeInt library which we
> hope will be included in Boost

I think such a library would be very useful. But as Ilya Bobir
mentions, it is very similar to Microsoft's SafeInt, developed by David
LeBlanc. Did you have a look at his library before?

Ilya Bobir wrote:
> I really doubt that you library will be accepted in its current form.
> For the following reasons:
[...]
> 4. x86 has hardware support for checking for integer overflows. It
> means that the OS may provide some means to check if an overflow has
> occurred. Using hardware may be way faster then doing the checks in the
> software.

Interesting! How would you use hardware to check int overflow?

> P.S. Your code seems to be very similar to what is published here:
> http://msdn.microsoft.com/en-us/library/ms972705.aspx

Indeed. Note that Microsoft's SafeInt will be shipped with MSVC 2010.
Actually, Visual Studio Beta 1 already has it placed at "C:\Program
Files\Microsoft Visual Studio 10.0\VC\include"

There's also a freely available version of David LeBlanc's SafeInt at
Microsoft's open source website, www.codeplex.com/SafeInt BTW, I did
help a little bit to get it compiling on GCC. :-)

Kind regards, Niels

-- 
Niels Dekker
http://www.xs4all.nl/~nd/dekkerware
Scientific programmer at LKEB, Leiden University Medical Center

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