Boost logo

Boost Users :

From: Paul Giaccone (paulg_at_[hidden])
Date: 2005-11-17 06:23:38


Daryle Walker wrote:

>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?
>
>

If users complain that the library isn't working because they forgot to
initialize something, and this is included in the documentation as a
reason for the exception that is thrown (stream error), as I have
suggested, then users might well still complain, but they can then be
told to RTFM :) There's no need to pander to slipshod programmers by
trying to deal with their broken code - all that is needed is an update
to the documentation. Simple solution.

Paul


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