Boost logo

Boost :

Subject: Re: [boost] Is there interest in portable integer overflow detection, with policy based handling?
From: Robert Ramey (ramey_at_[hidden])
Date: 2012-02-22 12:40:03


Ben Robinson wrote:
> It would appear there is interest in this library. Therefore, I am
> making the full source available on GitHub here:
>
> https://github.com/cppmaven/VerifiedInt
>
> The library consists of three header files:
>
> verified_int.hpp (the integer class)
> verified_int_policies.hpp (the overflow handling policies)
> detail/verified_int_overflow_detection.hpp (the TMP overflow detection
> routines)
>
> In addition, you will notice that some of the hundreds of unit tests
> make
> use of the metaassert.hpp capability. The VerifiedInt library
> contains a number of static assertions. MetaAssert allows me to
> write unit tests,
> which will pass only if the static assertion fails instead of
> passing. The trick is to convert what would be a compiler error into
> a runtime
> exception, and then detect the exception in the unit test.

Note that boost testing handles this by detecting failure
to compile as a legitmate, expecte result. That is there
exists the concept that a test must fail to compile in order
to be considered as passing the test.

Robert Ramey


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