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