Re: Why do you deserve a better IO library
* James Dennett:
Alf P. Steinbach wrote:
* psyko:
I'd be glad to hear you opinion.
Yes, the templated iostreams are inefficient, complex, and whatever bad
word exists for a design it applies to them; they even include two-phase
initialization and modal operation as if the designer searched the
darkest most inaccessible places for bad things to throw in, and,
although that's part of the "complex", they lack separation of concerns,
especially basic binary i/o versus formatting and parsing.
The separation into streambufs (for basic, unformatted I/O)
and streams (for parsing)?
It might seem as an attempt at separation, yes. But as mentioned, you
cannot implement "cat" for Windows using only standard C++
functionality. That's because you cannot access the underlying binary
i/o functionality of the standard input and output streams: you can only
access an interface that's on top of a modal translation engine where
the mode cannot be changed (all three aspects are horrible! and are not
things that occur naturally, they must be intentionally designed in).
To make matters even worse the interface lies to you.
It seems to say "I provide binary, unformatted output", but it doesn't.
I have a great dislike of the naming of many streambuf members,
but they're there for times when we just want a transport layer
without formatting.
Well, my point about that was that it simply /isn't/ there. You can
have one, or the other, but not both (and for standard input and output,
only one, namely translating mode). The formatting isn't built on top
of the binary i/o as it should be; instead it's interwoven in a
spaghetti way that can't be untangled within the confines of std C++.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]