Boost logo

Boost :

Subject: Re: [boost] updated version of safe integer library
From: Raphaël Londeix (raphael.londeix_at_[hidden])
Date: 2016-02-03 19:00:48


>
> Writing correct code is not considered a major problem by most
> programmers and organizations which depend on code. Code that works
> most of the time is considered good enough.
>

Well, good enough is perfect in most projects. However, I do like simple
drop-in wrappers that prevent stupid mistakes to ever compile, or that
abort on overflows.

About the construction topic, I think that a good compromise could be to
choose a safe default (always initialize to 0) but to allow one to be
explicitly unsafe:

safe<int> i; // i == 0
safe<int> j(boost::uninitialized); // undefined

It happens that the developer knows that initialization will be done later,
or has already been done (mapped memory for example).

Cheers,


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