Boost logo

Boost Users :

From: Daryle Walker (darylew_at_[hidden])
Date: 2005-11-17 06:08:01


On 11/13/05 10:01 AM, "David Abrahams" <dave_at_[hidden]> wrote:

> Daryle Walker <darylew_at_[hidden]> writes:
>
>> Reading from an uninitialized variable, like what could happen in the
>> original case during encoding, is not a problem any library can fix. The
>> programmer just has to be non-sloppy.
>
> I buy Robert's argument that, in the case of bool, the assertion will
> often help him diagnose the problem and help his users when they
> complain that the library isn't working because they forgot to
> initialize something.
[TRUNCATE]

Since Robert's test involves undefined behavior, it's not portable. The
assert may work on his system but may crash & burn on a different
environment. The assert didn't help the second user at all. And what
happens if the uninitialized variable just happens to match a valid state?

-- 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT hotmail DOT com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net