To the Pros out there:
Hy, im searching for a bug since 2 days, and i asked a lot of pros in my company, but nobody could help me.
Heres the situation:
Visual Studio Microsoft Visual Studio 2005 Version 8.0.50727.762 (SP.050727-7600)
I had a project with a strange bug, so i could melt down the problem into this simple program (I took the original Project and
deleted file after file to look when it would go correctly) and still got the strange behaviour.
heres the whole program, its a .vcproj-file project with 1 source file called main.cpp where the following is inside:
EventTest (int a_id, const std::string& a_text);
/*inline*/ EventTest::EventTest (int a_id, const std::string& a_text)
//m_Id = a_id;
//m_Text = a_text;
int main(int argc, char** argv)
EventTest test(1, "Text");
//std::string strTest = "TEST";
there are also some additional Dependencies in the Properties, but i wont mention it here.
The result when debugging it is extremely strange. its about the content of m_Text who is (watched with debugger) always
something like "0,0,0,0,T,e,x,t,-b,4,0,0,0,d,4,....." (and signs i cant write here) and so on with a string size of _MySize = 14220893!! instead of 4.
As soon as i use a variable of type std::string (the line that is commented now) all works fine!!!
I can make the behaviour the other way round as well: make the constructor inline, or initialize the members in the body. when doing either of the two, then the program works only correct (having "Text" in the string) when NOT having the variable of type std::string in the code!!
I made an other new project (not deleting things from the original project) with exactly the same code, the same project settings, and the same Dependencies. And this program is ALWAYS working correctly!!! but i cant find any difference, its like magic.
also the output (wich dlls are loaded) is the same.
The program would acctually work finde only this std::string in the class is nasty!
Does anybody has an idea? or a tipp how to analyze the problem further??
Im sure it is some strange sideeffect, but of what??
thanx for any input!