home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / cplus / 16152 < prev    next >
Encoding:
Text File  |  1992-11-12  |  1.5 KB  |  40 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!srg!enewton
  3. From: enewton@uucp (Eric C. Newton)
  4. Subject: Re: Just what is so great about streams?
  5. Reply-To: uunet.uu.net!srg!enewton
  6. Organization: means "in a rut"
  7. Date: 12 Nov 92 07:58:20
  8. Message-ID: <ENEWTON.92Nov12075820@lepton.uucp>
  9. In-Reply-To: tim@gold.iss.nus.sg's message of Thu, 12 Nov 1992 06:19:42 GMT
  10. References: <1992Nov12.061942.16473@nuscc.nus.sg>
  11. Sender: news@srg.srg.af.mil (Usenet news user)
  12. Lines: 26
  13.  
  14.  
  15.    This posting is a genuinely answer-seeking question,
  16.  
  17.      what _is_ so great about streams?
  18.  
  19. In our work we do a LOT of string formatting.  For the last few years
  20. most of our developers have been coding the formatting like so:
  21.  
  22.     char buff[BIGBUFFSIZE];
  23.     sprintf(buff,SOMEFORMAT,a,b,c,d);
  24.  
  25. and we had a LOT of memory overwrites.  BIGBUFFSIZE, is ususally some
  26. arbitrarilly silly constant, like 80, 256, 1024, etc.  It is never
  27. defined to be big enough for everyone.  Sure, all you have to do is
  28. change the constant and recompile, but if that recompile takes the
  29. better part of an afternoon, that is not very nice.  Besides, then we
  30. have lots of extra-long buff's in all of the rest of the code.
  31.  
  32. I have been championing the use of strstream and String for string
  33. formatting, and we have had a dramatic decrease in memory overwrites.
  34.  
  35. -Eric
  36. --
  37. Remember to mail to:     uunet.uu.net!srg!enewton    "The more you complain,
  38. <or>            enewton@oswego.oswego.edu    the longer God lets you
  39. <or>            enewton@access.digex.com     live."
  40.