Re: [boost] undefined behaviour in tuple_io.hpp (bug)(patch)

----Original Message---- From: Jonathan Wakely [mailto:cow@compsoc.man.ac.uk] Sent: 25 August 2005 11:42 To: boost@lists.boost.org Subject: Re: [boost] undefined behaviour in tuple_io.hpp (bug)(patch)
Rupert Kittinger wrote:
In the tuple_io.hpp header, there seems to be a slight problem in extract_and_check_delimiter(). The following snippet is problematic:
char c; if (is_delimiter) { is >> c; if (c!=d) { is.setstate(std::ios::failbit); } }
If c cannot be read because is.eof(), the result of c!=d is undefined.
IMHO the fix is neater as:
if (is>>c && c!=d)
basic_ios::operator void*() exists to support this syntax rather than explicitly testing the state with good(), fail() etc.
And IMveryHO, the original patch is neater. This is a religous issue; I think the only sensible approach is to require each individual library to be consistent, and let the library developer / maintainer make the decision. (Apologies if you /are/ the maintainer of Boost.Tuple - I looked, but couldn't find a list of library maintainers.) -- Martin Bonner Martin.Bonner@Pitechnology.com Pi Technology, Milton Hall, Ely Road, Milton, Cambridge, CB4 6WZ, ENGLAND Tel: +44 (0)1223 441434
participants (1)
-
Martin Bonner