[LC++]Curiosity
Dr Mark H Phillips
mark at austrics.com.au
Wed Dec 3 15:19:01 UTC 2003
Hi,
I have found what appears to be either a compiler
error or an error in the standard string library. It
is rather odd.
I've attached the code below. Basically I start with
a pointer to a (string,int) pair. Then I call a
"function" which shouldn't harm anything, but afterwards
when I try to print the pair, the string has been
corrupted.
Now the version of g++ I was using was 2.95.4. I did
try compiling it using version 3.2.2 and the problem
disappeared. I have also found that by changing
Dequote to:
struct Dequote {
std::string operator()(std::string const& token) const {
etc...
(so that there is now a const reference in there) everything
works fine under 2.95.4.
So I've found a work-around. The reason I'm posting this to
the list is that I'm curious. I'm wondering whether this is
a compiler error that they fixed in the 3.*.* series, or whether
the earlier string implementation was buggy, or whether something
else is going on. Does anyone know?
Cheers,
Mark.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dequoteTst.cc
Type: text/x-c++
Size: 568 bytes
Desc: not available
Url : http://lists.linux.org.au/pipermail/tuxcpprogramming/attachments/20031203/0815ec85/attachment.bin
More information about the tuxCPProgramming
mailing list