Boost logo

Boost :

Subject: Re: [boost] Is there interest in portable integer overflow detection, with policy based handling?
From: Ben Robinson (cppmaven_at_[hidden])
Date: 2012-02-22 10:56:16


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.

Enjoy!

Ben Robinson


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