Topic: About WP 238 of the LWG


Author: vincent_leloup@yahoo.fr ("Vincent Leloup")
Date: Thu, 20 Nov 2003 03:16:10 +0000 (UTC)
Raw View
What do you think about the work paper 238 of the library work group ?
I've some problems with it: I understood the standard differently as exposed
in it and so
I think the problem isn't in that constructor but in the description of the
function str() const.

Explanation:
In the section 27.7.1.1/3, I think there is 3 different sequences:
- the underlying character sequence which is always initialized (even in the
case which == ios_base::openmode(0));
    (first part of the second sentence)
- the output sequence which is initialized if (which & ios_base::out) is
true; (third sentence) and
- the input sequence which is initialized if (which & ios_base::in) is true
(fourth sentence).

Then, in section 27.7.1.2/1 str() const is described to return: a
"basic_string object whose content is equal
to the basic_stringbuf underlying character sequence."

So, for a basic_stringbuf constructed with the second constructor (section
27.7.1.1/3),
this function returns the underlying character sequence which is always
initialized with the constructor argument str.
With this argument, the constructor postcondition: str() == str is true.

I think the problem is in the second sentence of section 27.7.1.2/1 instead.
This sentence is another description of the str() const but the second part
of this sentenc
("otherwise, it is equal to the output sequence") is inconsistent.
This "otherwise" represents the following cases !((which & ios_base::in) &&
!(which & ios_base::out)) which are :
- (which & ios_base::in) && (which & ios_base::out) is true, output sequence
initialized : consistent case;
- !(which & ios_base::in) && (which & ios_base::out) is true, output
sequence initialized : consistent case; and
- !(which & ios_base::in) && !(which & ios_base::out) is true,
    output sequence not initialized to underlying character sequence :
inconsistent case.

Is it enough clear ? Am I right with this argument, otherwise the
postcondition 27.7.1.2/3 seems to have the same problem.

Vincent Leloup


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]