Paul Giaccone
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