gcc4.1.2 and 4.3.2 has different default behavior

2011-03-08 Thread Yixuan Huang
Hello All,
I have encountered one issue when write a simple test code.
#inlcude 
int main{
  const char* str = "";
  std::cout<<"str len: "<

gcc 3.2 compile issue when initialize value

2010-05-20 Thread Yixuan Huang
Hello,

I wrote following code:
#include 
#include 
#include 
int main()
{
struct dirent **namelist;
int numberOfProcDirs;
numberOfProcDirs=scandir("/proc", &namelist, 0, alphasort);
//std::string temp(std::string(namelist[0]->d_name)+std::string("fdsfds"));
//std::string temp(std::string(namelist[0]->d_name)+std::string("fdsf"));
// The error occured
std::string temp(std::string(namelist[0]->d_name)+std::string("cfdada"));
//std::string temp;
//temp = std::string(namelist[0]->d_name)+std::string("cfdada");
return 0;
}

When compiled under g++ 3.2, it would report compile error.

test.cpp: In function `int main()':
test.cpp:12: syntax error before `->' token

But code can compile under gcc 4.

Is this a limitation for gcc 3.2 when I used "std::string
temp(std::string(namelist[0]->d_name)+std::string("cfdada"));" to
initialize value.


Thanks,
yixuan