Boost logo

Boost :

From: Ross Smith (r-smith_at_[hidden])
Date: 2001-12-19 16:18:27


I submit that a tight coupling between sockets and iostreams -- by which
I mean a socket library designed on the assumption that iostreams will
be the principal socket I/O mechanism -- would be a very bad idea. I'll
try to explain why.

Iostream formatting operations are designed for human readable output.
Writing an integer, for example, gives you the ordinary decimal
representation by default, with ASCII (or whatever your local charset
is) characters and variable width. Getting a fixed-width or non-decimal
representation requires awkward work with manipulators; getting a binary
representation (native binary data, I mean, not binary digits in ASCII)
is impossible.

You can write I/O operators that use a binary representation, of course.
But (1) you can only do that for your own types, not native types; (2)
you can only do that _instead of_, not as well as, human readable
output; and (3) you still get all the runtime overhead of iostreams even
though none of it is needed.

I'm convinced that iostreams should be reserved strictly for human
readable text I/O, and not used for computer-to-computer communication,
such as sockets.

In view of the above, I for one will vote NO to any proposed socket
library that makes heavy use of iostreams, because I consider that a
showstopper regardless of any other merits the library may have.

-- 
Ross Smith ...................................... Auckland, New Zealand
r-smith_at_[hidden] ......................... http://storm.net.nz/~ross/
  "We need a new cosmology. New gods. New sacraments. Another drink."
                                                       -- Patti Smith

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk