L
Lighter
I find a BIG bug of VS 2005 about string class!
#include <iostream>
#include <string>
using namespace std;
string GetStr()
{
return string("Hello");
}
int main(int argc, char *argv[])
{
const char* p = GetStr().c_str();
cout << p << endl;
cin.get();
}
============================
Run the code above, Dev C++ will normally output the string "Hello",
however, VS 2005 should output an empty string!
In my opinion, string class is vital to almost every C++ program, and
VS 2005 as a C++ compiler is a widely used by programmers, if string
class is wrongly implemented by Microsoft, that will be a disaster!
#include <iostream>
#include <string>
using namespace std;
string GetStr()
{
return string("Hello");
}
int main(int argc, char *argv[])
{
const char* p = GetStr().c_str();
cout << p << endl;
cin.get();
}
============================
Run the code above, Dev C++ will normally output the string "Hello",
however, VS 2005 should output an empty string!
In my opinion, string class is vital to almost every C++ program, and
VS 2005 as a C++ compiler is a widely used by programmers, if string
class is wrongly implemented by Microsoft, that will be a disaster!