This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Carlo Wood <carlo@alinoe.com> writes:

| On Fri, Aug 13, 2004 at 07:30:35PM +0200, Gabriel Dos Reis wrote:
| > We seem to have diverged on the reality of the examples :-)
| 
| As a man of practise, I can assure you that no matter how
| much one thinks that there is "no need" for something - there
| ALWAYS is a need for it, by someone, somewhere.
| 
| Even the fact that this whole list cannot come up with an
| example that satisfies you, should not be a reason to question
| the correctness of this fix: it is almost an axioma for libraries
| to assume there IS a need.

Const-correctness is a good, sound design principle when it is
not hold as a dogma.  Making a function const, in an interface or
abstract class, put a *high* constaint on the ways it could be
implemented. Actually, it reduces the set of implementation
possibilities. It exposes implementation details in the interface.
That is why I maintain it should be questioned each time it is applied.
For example, with your const external_extrophy, you exclude "lazy
evaluation", unless one adds extra indirection.  The same goes for the
is_open(). 

Some people have said that I'm being dogmatic because I refuse to be
dogmatic about const-correctness.  I suspect that they did not
actually give the issue as thoughts as they should. I would encourage
them to put aside any preconception they may have about me or the
issue, and try to analyze the issue at hand. 

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]