Very Strange behavior happened to me. I am using latest Cygwin32, Cygwin64 and MinGW32 with GCC 4.9.2 , 4.9.2 and 4.8.1 respectively on Windows 7 64-bit. I am testing also on 32-bit Linux using GCC 4.8.2.
So on all systems this works
#include <bits/stdc++.h>
using namespace std;
string s,t;
int main(){
cin>>s>>t;
cout<<s;
}
and this works
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
string s="a",t="b";
int main(){
cin>>s>>t;
cout<<s;
}
but the next one crashes on Windows after inputting the first string on the 3 configurations mentioned above, but works correctly on Linux:
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
string s,t;
int main(){
cin>>s>>t;
cout<<s;
}
Clearly the only difference is that the string is empty before inputting, and _GLIBCXX_DEBUG
is enabled.
First, is this a reproducible problem? i.e. does it happen on every PC with the same configuration , or only my PC? Second, What is the problem? What should I do? I clearly need _GLIBCXX_DEBUG
to debug other STL structures in the code.