public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* ostrstream problem
@ 2005-09-28  3:00 Ernest L. Williams Jr.
  2005-09-28  7:36 ` Peter Doerfler
  2005-09-28 12:22 ` John Love-Jensen
  0 siblings, 2 replies; 4+ messages in thread
From: Ernest L. Williams Jr. @ 2005-09-28  3:00 UTC (permalink / raw)
  To: GCC-Help

Hi,

I am now using gcc 4.0.1.

I get the following error:
====================================================
error: ‘ostrstream’ was not declared in this scope
===================================================


What header must I use to get ostrstream?

I tried : #include <sstream>

I am confused. 
Any help or reference is welcomed and appreciated.



Thanks,
Ernest L. Williams Jr.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ostrstream problem
  2005-09-28  3:00 ostrstream problem Ernest L. Williams Jr.
@ 2005-09-28  7:36 ` Peter Doerfler
  2005-09-28 12:22 ` John Love-Jensen
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Doerfler @ 2005-09-28  7:36 UTC (permalink / raw)
  To: gcc-help, ernesto

Hi Ernest.

"strstream has been deprecated in the C++98 standard because the standards 
committee felt it was superseded by stringstream, which better encapsulates 
memory management. strstream is still an official part of the standard that 
conforming C++ implementers must provide."
[distilled from Herb Sutter's http://www.gotw.ca/publications/mill19.htm]

So you can either use ostringstream or include backward/strstream (found by 
grep). Note that I haven't checked if the ostrstream now in backward is the 
same that used to be in the general include directory in previous versions.

HTH, Peter


On Wednesday 28 September 2005 05:00, Ernest L. Williams Jr. wrote:
> Hi,
>
> I am now using gcc 4.0.1.
>
> I get the following error:
> ====================================================
> error: ‘ostrstream’ was not declared in this scope
> ===================================================
>
>
> What header must I use to get ostrstream?
>
> I tried : #include <sstream>
>
> I am confused.
> Any help or reference is welcomed and appreciated.
>
>
>
> Thanks,
> Ernest L. Williams Jr.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ostrstream problem
  2005-09-28  3:00 ostrstream problem Ernest L. Williams Jr.
  2005-09-28  7:36 ` Peter Doerfler
@ 2005-09-28 12:22 ` John Love-Jensen
  2005-09-28 22:38   ` Ernest L. Williams Jr.
  1 sibling, 1 reply; 4+ messages in thread
From: John Love-Jensen @ 2005-09-28 12:22 UTC (permalink / raw)
  To: ernesto, MSX to GCC

Hi Ernest,

I second what Peter said.

Plus....

You should be aware in switching from ostrstream to std::ostringstream...

std::ostringstream does the memory management for you.  You don't need to
trouble yourself with ostrstream's memory management burden.  That alone is
worth switching instead of trying to use the obsolete ostrstream!

std::ostringstream's backing store is a std::string, so you don't need the
ends terminator.

Sincerely,
--Eljay

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ostrstream problem
  2005-09-28 12:22 ` John Love-Jensen
@ 2005-09-28 22:38   ` Ernest L. Williams Jr.
  0 siblings, 0 replies; 4+ messages in thread
From: Ernest L. Williams Jr. @ 2005-09-28 22:38 UTC (permalink / raw)
  To: John Love-Jensen; +Cc: MSX to GCC

On Wed, 2005-09-28 at 07:20 -0500, John Love-Jensen wrote:
> Hi Ernest,
> 
> I second what Peter said.
> 
> Plus....
> 
> You should be aware in switching from ostrstream to std::ostringstream...
> 
> std::ostringstream does the memory management for you.  You don't need to
> trouble yourself with ostrstream's memory management burden.  That alone is
> worth switching instead of trying to use the obsolete ostrstream!
> 
> std::ostringstream's backing store is a std::string, so you don't need the
> ends terminator.

Awesome.  I will definitely be using std::ostringstream in the future.


Thanks,
Ernest


> 
> Sincerely,
> --Eljay
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-09-28 22:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-28  3:00 ostrstream problem Ernest L. Williams Jr.
2005-09-28  7:36 ` Peter Doerfler
2005-09-28 12:22 ` John Love-Jensen
2005-09-28 22:38   ` Ernest L. Williams Jr.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).