home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / cplus / 16214 < prev    next >
Encoding:
Internet Message Format  |  1992-11-13  |  1.4 KB

  1. Path: sparky!uunet!snorkelwacker.mit.edu!ai-lab!life.ai.mit.edu!tmb
  2. From: tmb@arolla.idiap.ch (Thomas M. Breuel)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Just what is so great about streams?
  5. Date: 13 Nov 92 10:29:51
  6. Organization: IDIAP (Institut Dalle Molle d'Intelligence Artificielle
  7.     Perceptive)
  8. Lines: 25
  9. Message-ID: <TMB.92Nov13102951@arolla.idiap.ch>
  10. References: <1992Nov12.061942.16473@nuscc.nus.sg>
  11. Reply-To: tmb@idiap.ch
  12. NNTP-Posting-Host: arolla.idiap.ch
  13. In-reply-to: tim@gold.iss.nus.sg's message of Thu, 12 Nov 1992 06:19:42 GMT
  14.  
  15. In article <1992Nov12.061942.16473@nuscc.nus.sg> tim@gold.iss.nus.sg (Tim Poston) writes:
  16.  
  17.    This posting is a genuinely answer-seeking question,
  18.  
  19.      what _is_ so great about streams?
  20.  
  21. Mainly that they are type-safe and user-extensible.
  22.  
  23.    From a coding standpoint, the << operator seems to be a case of
  24.    `user-friendly disease'.  I have to do 'x << " " << y' just to get
  25.    a space between output numbers.
  26.  
  27. Actually, I suspect most people would agree that stream syntax is
  28. pretty awful.
  29.  
  30.    Typical user-friendliness: "don't worry about type, I'll look at it
  31.    and do what's best", with no judgement needed by the programmer.
  32.    But sometimes Mom does not know best.  For instance, if the output
  33.    is PostScript code, a number very near zero should _not_ be output
  34.    as 1.472e-6 It should be 0.0, or PostScript will barf.
  35.  
  36. Streams come with various formatting primitives for floating
  37. point; use them.
  38.  
  39.                     Thomas.
  40.