Boost logo

Boost :

From: Martin Bonner (martin.bonner_at_[hidden])
Date: 2005-08-25 06:45:27

----Original Message----
From: Jonathan Wakely [mailto:cow_at_[hidden]]
Sent: 25 August 2005 11:42
To: boost_at_[hidden]
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
Pi Technology, Milton Hall, Ely Road, Milton, Cambridge, CB4 6WZ,
ENGLAND Tel: +44 (0)1223 441434

Boost list run by bdawes at, gregod at, cpdaniel at, john at