Best way to handle 'ostrstream'

E

Eric Chomko

I inherited a task which uses a lot of 'ostrstream' in the code. The port
is from an SGI box to Sun which is using GNU C++ (g++ version 3.4.2). When
trying to compile I get several errors all related to 'ostrstream' and the
fact that it is being deprecated from the language, etc.

What is the best way to handle fixing this replicating error?

TIA,
Eric
 
M

mlimber

Eric said:
I inherited a task which uses a lot of 'ostrstream' in the code. The port
is from an SGI box to Sun which is using GNU C++ (g++ version 3.4.2). When
trying to compile I get several errors all related to 'ostrstream' and the
fact that it is being deprecated from the language, etc.

What is the best way to handle fixing this replicating error?

"Replicating error"? Not sure what that is.

The immediate fix could be to turn off that warning (it's not really an
error, right?) with a command line switch. If that doesn't work, you
could use a modified (or third-party) strstream library that doesn't
issue those warnings/errors but has the same syntax (save, perhaps, the
std namespace), or you could convert it to using std::eek:stringstream.

Cheers! --M
 
E

Eric Chomko

mlimber ([email protected]) wrote:
: Eric Chomko wrote:
: > I inherited a task which uses a lot of 'ostrstream' in the code. The port
: > is from an SGI box to Sun which is using GNU C++ (g++ version 3.4.2). When
: > trying to compile I get several errors all related to 'ostrstream' and the
: > fact that it is being deprecated from the language, etc.
: >
: > What is the best way to handle fixing this replicating error?

: "Replicating error"? Not sure what that is.

Sorry, not good usage. I should have said "reoccurring", as this error is
in many places in the code.

: The immediate fix could be to turn off that warning (it's not really an
: error, right?) with a command line switch. If that doesn't work, you
: could use a modified (or third-party) strstream library that doesn't
: issue those warnings/errors but has the same syntax (save, perhaps, the
: std namespace), or you could convert it to using std::eek:stringstream.

It is an error not a warning. Where would I put the "std::eek:stringstream"?
In the modified strstream include?

Eric

: Cheers! --M
 
M

Mike Wahler

Eric Chomko said:
mlimber ([email protected]) wrote:
: Eric Chomko wrote:
: > I inherited a task which uses a lot of 'ostrstream' in the code. The
port
: > is from an SGI box to Sun which is using GNU C++ (g++ version 3.4.2).
When
: > trying to compile I get several errors all related to 'ostrstream' and
the
: > fact that it is being deprecated from the language, etc.
: >
: > What is the best way to handle fixing this replicating error?

: "Replicating error"? Not sure what that is.

Sorry, not good usage. I should have said "reoccurring", as this error is
in many places in the code.

: The immediate fix could be to turn off that warning (it's not really an
: error, right?) with a command line switch. If that doesn't work, you
: could use a modified (or third-party) strstream library that doesn't
: issue those warnings/errors but has the same syntax (save, perhaps, the
: std namespace), or you could convert it to using std::eek:stringstream.

It is an error not a warning.

We'll need to see the code causing the errors, and the text
of the error messages. I realize your code is probably too
large to post here, so try to create a small example program
which gives the same error, and post it.
Where would I put the "std::eek:stringstream"?
In the modified strstream include?

You'd replace all your ostrstream objects with ostringstream objects.
Some of the operations and semantics are different, so it will probably
not be a 'drop in' replacement. Compare the documentation of ostrstream
and ostringstream to see how to do what you need (btw ostringstream is
declared by <sstream> )

-Mike
 
E

Eric Chomko

Mike Wahler ([email protected]) wrote:

: : > mlimber ([email protected]) wrote:
: > : Eric Chomko wrote:
: > : > I inherited a task which uses a lot of 'ostrstream' in the code. The
: > port
: > : > is from an SGI box to Sun which is using GNU C++ (g++ version 3.4.2).
: > When
: > : > trying to compile I get several errors all related to 'ostrstream' and
: > the
: > : > fact that it is being deprecated from the language, etc.
: > : >
: > : > What is the best way to handle fixing this replicating error?
: >
: > : "Replicating error"? Not sure what that is.
: >
: > Sorry, not good usage. I should have said "reoccurring", as this error is
: > in many places in the code.
: >
: > : The immediate fix could be to turn off that warning (it's not really an
: > : error, right?) with a command line switch. If that doesn't work, you
: > : could use a modified (or third-party) strstream library that doesn't
: > : issue those warnings/errors but has the same syntax (save, perhaps, the
: > : std namespace), or you could convert it to using std::eek:stringstream.
: >
: > It is an error not a warning.

: We'll need to see the code causing the errors, and the text
: of the error messages. I realize your code is probably too
: large to post here, so try to create a small example program
: which gives the same error, and post it.

Will do...

: > Where would I put the "std::eek:stringstream"?
: > In the modified strstream include?

: You'd replace all your ostrstream objects with ostringstream objects.
: Some of the operations and semantics are different, so it will probably
: not be a 'drop in' replacement. Compare the documentation of ostrstream
: and ostringstream to see how to do what you need (btw ostringstream is
: declared by <sstream> )

Thanks,
Eric

: -Mike
 
E

Eric Chomko

Eric Chomko ([email protected]) wrote:
: Mike Wahler ([email protected]) wrote:

: : : : > mlimber ([email protected]) wrote:
: : > : Eric Chomko wrote:
: : > : > I inherited a task which uses a lot of 'ostrstream' in the code. The
: : > port
: : > : > is from an SGI box to Sun which is using GNU C++ (g++ version 3.4.2).
: : > When
: : > : > trying to compile I get several errors all related to 'ostrstream' and
: : > the
: : > : > fact that it is being deprecated from the language, etc.
: : > : >
: : > : > What is the best way to handle fixing this replicating error?
: : >
: : > : "Replicating error"? Not sure what that is.
: : >
: : > Sorry, not good usage. I should have said "reoccurring", as this error is
: : > in many places in the code.
: : >
: : > : The immediate fix could be to turn off that warning (it's not really an
: : > : error, right?) with a command line switch. If that doesn't work, you
: : > : could use a modified (or third-party) strstream library that doesn't
: : > : issue those warnings/errors but has the same syntax (save, perhaps, the
: : > : std namespace), or you could convert it to using std::eek:stringstream.
: : >
: : > It is an error not a warning.

: : We'll need to see the code causing the errors, and the text
: : of the error messages. I realize your code is probably too
: : large to post here, so try to create a small example program
: : which gives the same error, and post it.

: Will do...

Here is the error text:

/tcore/TigErrList.cpp:136: error: `ostrstream' undeclared (first use this
function)
/tcore/TigErrList.cpp:136: error: (Each undeclared identifier is reported
only once for each function it appears in.)
/tcore/TigErrList.cpp:136: error: expected `;' before "buff"
/tcore/TigErrList.cpp:139: error: `buff' undeclared (first use this
function)

Here is the code segment:
ostrstream buff;

I'm pretty sure that the class 'oststream' is not defined.

: : > Where would I put the "std::eek:stringstream"?
: : > In the modified strstream include?

: : You'd replace all your ostrstream objects with ostringstream objects.
: : Some of the operations and semantics are different, so it will probably
: : not be a 'drop in' replacement. Compare the documentation of ostrstream
: : and ostringstream to see how to do what you need (btw ostringstream is
: : declared by <sstream> )

Yes, the include module strstream.h is now obsolete and it had the
definition of 'ostrstream' in it.

Eric

: Thanks,
: Eric

: : -Mike
 
M

mlimber

Eric said:
: Mike Wahler ([email protected]) wrote: [snip]
: : We'll need to see the code causing the errors, and the text
: : of the error messages. I realize your code is probably too
: : large to post here, so try to create a small example program
: : which gives the same error, and post it.

: Will do...

Here is the error text:

/tcore/TigErrList.cpp:136: error: `ostrstream' undeclared (first use this
function)
/tcore/TigErrList.cpp:136: error: (Each undeclared identifier is reported
only once for each function it appears in.)
/tcore/TigErrList.cpp:136: error: expected `;' before "buff"
/tcore/TigErrList.cpp:139: error: `buff' undeclared (first use this
function)

Here is the code segment:
ostrstream buff;

I'm pretty sure that the class 'oststream' is not defined.
[snip]

What is in the file strstream.h, then? Could ostrstream be in the std
namespace? If it's simply not defined, find an implementation of it
(see stlport, for instance) and use that.

Cheers! --M
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,685
Members
48,796
Latest member
Greg L.

Latest Threads

Top