[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Is this a bug in G++ STL ?
From: |
Jerry |
Subject: |
Is this a bug in G++ STL ? |
Date: |
1 Sep 2002 18:24:44 -0700 |
I met a strange problem while trying string class in Standard
Template Library .
//////////////////////////////////////////////////////
#include <stdio.h>
#include <string>
using namespace std ;
main()
{
string ss = "hello ";
{
string s1 = ss+ "my Friend";
printf("%s\n", s1.data());
}
{
string s2 = ss+ "my God";
printf("%s\n", s2.data());
}
}
//////////////////////////////////////////////////////
When I compile these code using GCC under Linux and FreeBSD, I got a
result like this:
hello my Friend
hello my Godend
If I compile the code using MSVC, I got this:
hello my Friend
hello my God
Is there a bug in GCC compiler or I was just doing wrong?
- Is this a bug in G++ STL ?,
Jerry <=