Hi, Jerry Jankura!
On 28 Mar 97 14:48:01 you wrote to Mike Walker
JJ> Mike - Let me offer a few advantages of stream I/O
JJ> 1. The same symbols (">") or function names are used to read
JJ> from, or write to
JJ> 2. Stream I/O is extensible, standard I/O is not. For example, you can
JJ> 3. Stream I/O is parsed at compile time, stdio is parsed at run time.
JJ> 4. If you're willing to derive objects from streambuf and iostream,
JJ> you can build your own devices (perhaps a "modem" or an "ascii
You didn't mention the most important advantage(s): they kill negative
redundancy and eliminate need a (...) call.
With printf clones you must take care to keep the format string and all the
passed arguments consistent. And manually cast all the pases params to the
type in the string. Failing to do so you'll encounter nasty bugs,
discovered only at runtime. (In my experience they get a high percentage of
bugs surviving compilation.) Using streams i/o the type is determined by the
compiler, looking directly the object you use as the parameter.
Paul
... An ounce of application is worth a ton of abstraction.
--- OS/2 Warp
---------------
* Origin: The FlintStones' Cave in BedRock (2:371/20)
|