Should basic_*stream::is_open() be const?

Gabriel Dos Reis gdr@integrable-solutions.net
Fri Aug 13 13:47:00 GMT 2004


Andreas Kohn <andreas@syndrom23.de> writes:

| On Fri, 2004-08-13 at 12:44, Gabriel Dos Reis wrote:
| > Paolo Carlini <pcarlini@suse.de> writes:
| > 
| > | Andreas Kohn wrote:
| > | 
| > | >So, if I read this correctly, "Note that implementers can make this
| > | >change in a binary compatible way by providing both overloads; this
| > | >would be a conforming extension." overloads could be added to libstdc++
| > | >without violating the standard?
| > | >
| > | >Is anything like that planned?
| > | >
| > | Ok, I'm going to apply the below to mainline (would be 3.5.0 or 4.0), not to
| > | the release branch, however, since we want complete backward and forward
| > | compatibility.
| > 
| > Still, I find the need to this addition very dubious.
| > 
| Without this methods being const (which they should be IMHO from a
| logical perspective, as they do not change the internal state of the
| stream but simply return state information), methods that use these
| methods can not be const.
| This "can not be const" will easily cascade into upper layers, which
| reduces quality and safeness of the code.
| 
| What are your doubts? Is there anything I might miss?

What do you do with a const stream?

-- Gaby



More information about the Libstdc++ mailing list