|
Boost Users : |
From: David Abrahams (dave_at_[hidden])
Date: 2005-11-17 18:50:40
Paul Giaccone <paulg_at_[hidden]> writes:
> Daryle Walker wrote:
>
>>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)
An exception is inappropriate as a documented response to
uninitialized data. Any test that could detect uninitialized data
causes undefined behavior anyway, so you can't promise to throw an
exception. The program counter could already be in never-never land.
-- Dave Abrahams Boost Consulting www.boost-consulting.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