STL bug in VS.NET 2002

Discussion in 'C++' started by Antonio Maiorano, Nov 8, 2003.

  1. 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
     
    Antonio Maiorano, Nov 8, 2003
    #1
    1. Advertising

  2. On Sat, 8 Nov 2003 12:38:14 -0500, "Antonio Maiorano"
    <> 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.
     
    Thore Karlsen, Nov 8, 2003
    #2
    1. Advertising

  3. Antonio Maiorano

    Mike Wahler Guest

    "Antonio Maiorano" <> wrote in message
    news:LR9rb.91771$...
    > 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
     
    Mike Wahler, Nov 8, 2003
    #3
  4. Antonio Maiorano

    P.J. Plauger Guest

    "Antonio Maiorano" <> wrote in message
    news:LR9rb.91771$...

    > 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
     
    P.J. Plauger, Nov 8, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sunker

    VS.NET 2002 vs VS.NET 2003

    sunker, Jul 20, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    411
    R.Balaji
    Jul 23, 2004
  2. Sami
    Replies:
    8
    Views:
    465
    =?Utf-8?B?VHk=?=
    Jan 8, 2005
  3. Alvin Bruney

    Re: bug in .NET 2002 IDE Debugger.

    Alvin Bruney, Jul 25, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    378
    Alvin Bruney
    Jul 25, 2003
  4. Niklas Uhlin

    Session_Start and Microsoft Word 2002 bug?

    Niklas Uhlin, Jun 16, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    432
    Niklas Uhlin
    Jun 21, 2004
  5. =?Utf-8?B?TWFya3VzIE1jR2Vl?=

    Migrating ASP.NET projects between VS.NET 2002 and VS.NET 2003

    =?Utf-8?B?TWFya3VzIE1jR2Vl?=, Dec 2, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    346
    =?Utf-8?B?TWFya3VzIE1jR2Vl?=
    Dec 6, 2004
Loading...

Share This Page