By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,389 Members | 1,881 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,389 IT Pros & Developers. It's quick & easy.

STL bug in VS.NET 2002

P: n/a
Hi everyone,

I use Visual Studio .NET 2002 right now, and I discovered a bug last night
that I have found few references to on the internet. Basically, if you
allocated a null-terminated char array that is 16 bytes or longer to
std::string, it stores garbage into it:

std::string s = "1234567890123456";

I tried this on .NET 2003 at work, and this bug has been fixed. Indeed, I
stepped into the string code, and found the difference somewhere in
<xstring>.

Anyway, my question is: what do I do? Do I really have to remove 2002 and
install 2003? Is there an bug-free STL implementation that I can download
somewhere and use instead? I have found no mention of this bug on M$ website
(big surprise).

Thank you for your time,

Tony
Jul 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Sat, 8 Nov 2003 12:38:14 -0500, "Antonio Maiorano"
<ma******@videotron.ca> wrote:
Hi everyone,

I use Visual Studio .NET 2002 right now, and I discovered a bug last night
that I have found few references to on the internet. Basically, if you
allocated a null-terminated char array that is 16 bytes or longer to
std::string, it stores garbage into it:

std::string s = "1234567890123456";

I tried this on .NET 2003 at work, and this bug has been fixed. Indeed, I
stepped into the string code, and found the difference somewhere in
<xstring>.

Anyway, my question is: what do I do? Do I really have to remove 2002 and
install 2003? Is there an bug-free STL implementation that I can download
somewhere and use instead? I have found no mention of this bug on M$ website
(big surprise).


It's not a bug. Strings 16 characters or shorter are stored in the
object, while longer strings are stored on the heap. The debugger just
doesn't show the heap-allocated strings by default.

--
Be seeing you.
Jul 19 '05 #2

P: n/a

"Antonio Maiorano" <ma******@videotron.ca> wrote in message
news:LR*********************@weber.videotron.net.. .
Hi everyone,

I use Visual Studio .NET 2002 right now, and I discovered a bug last night
that I have found few references to on the internet. Basically, if you
allocated a null-terminated char array that is 16 bytes or longer to
std::string, it stores garbage into it:

std::string s = "1234567890123456";
What specific code did you use that caused you to come to this
conclusion?

I tried this on .NET 2003 at work, and this bug has been fixed.
I'm not yet convinced you've discovered a bug.
Indeed, I
stepped into the string code, and found the difference somewhere in
<xstring>.
Difference between what and what?

Anyway, my question is: what do I do?
First confirm that there really is a bug.
Do I really have to remove 2002 and
install 2003? Is there an bug-free STL implementation that I can download
somewhere and use instead? I have found no mention of this bug on M$ website (big surprise).


I don't see you referring to any particular 'bug.'
What behavior are you getting with what code that
causes you to cry 'bug'?

-Mike
Jul 19 '05 #3

P: n/a
"Antonio Maiorano" <ma******@videotron.ca> wrote in message
news:LR*********************@weber.videotron.net.. .
I use Visual Studio .NET 2002 right now, and I discovered a bug last night
that I have found few references to on the internet. Basically, if you
allocated a null-terminated char array that is 16 bytes or longer to
std::string, it stores garbage into it:

std::string s = "1234567890123456";

I tried this on .NET 2003 at work, and this bug has been fixed. Indeed, I
stepped into the string code, and found the difference somewhere in
<xstring>.

Anyway, my question is: what do I do? Do I really have to remove 2002 and
install 2003? Is there an bug-free STL implementation that I can download
somewhere and use instead? I have found no mention of this bug on M$ website (big surprise).


The bug is in the debugger, which fails to display long strings properly.
(We use the Small String Optimization from V7.0 onward.) The strings
themselves are correct.

P.J. Plauger
Dinkumware, Ltd.
www.dinkumware.com
Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.