Re: Why do you deserve a better IO library
* kanze:
Alf P. Steinbach wrote:
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).
But that's something we inherited from C, and that we won't be
able to change as long as our IO is defined in terms of and by
reference to the C standard.
Currently there's no assumption of e.g. std::cout being based on stdout.
The problem is that that infernal translation, or rather, the
/possibility/ of such translation occurring, has been misguidedly
designed in for C++ i/o, in the same way as in the C streams.
The only positive effect is to make it "easy" for a C++ implementor to
reuse the C library's translation, and for that we pay the price of
totally crippled i/o functionality (so that it's often not used anyway).
[snip]
I think you're missing the point that the distinction
binary/text is based on a distinction of actual file types in
many systems. This means that there really isn't anyway to
handle it otherwise.
Sorry, James, that's incorrect.
There are systems for which stream i/o isn't possible, but that doesn't
stop us from having it in the standard. There are /conceivably/ systems
where binary i/o isn't possible, but hey, it's in the standard anyway.
There's no system where static type checking can guarantee that you're
using only allowable operations for the right kind of file: that's a
run-time thing, always with the possibility of run-time failure, and it
provides an abundance of options of how to handle it, very otherwise.
Just to show how silly that "can't be done otherwise because of system
XYZ" really is, consider systems with only fixed size record files.
Can't have anything else than fixed size record i/o in the C++ standard
library, because really, it can't be handled otherwise. Hello.
--
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! ]