   weird VC++ problem (Debug works, Release do not)
  I'm coding a planet renderer but today I found a weird bug on my application that is driving me crazy. I'm using VC++ 6.0.I need to store some fast to retrieve data so I'm using a std::map, but unless using strings or ints for the key, I'm using my own class, called NodeName which has implemented all common operators:NodeName();NodeName(const NodeName& c);~NodeName();const NodeName& operator = (const NodeName& c);bool operator == (const NodeName& c) const;bool operator != (const NodeName& c) const;bool operator > (const NodeName& c) const;bool operator < (const NodeName& c) const;bool operator >= (const NodeName& c) const;bool operator <= (const NodeName& c) const;then when after insert a pair in the map, if I retrieve it in release the maps says it has not been found, but in debug it works!! it finds it!here is the testing code:std::map<NodeName,int> mymap;NodeName a,b;a << 1;b << 2;mymap.insert( std::make_pair<NodeName,int>(a, 23) );mymap.insert( std::make_pair<NodeName,int>(b, 51) );std::map<NodeName,int>::iterator it = mymap.find(a);if (it == mymap.end())std::cout << "NO!" << std::endl;elsestd::cout << "YES: " << it->second << std::endl;I tryed to add std::cout's in all the operator to check if both (debug and release) use then same ones and it does.Does anybody know the main diferences between release and debug? I have to say that my NodeName class has all the initialitations done.Thanks in advance.   
  There main difference is that the debug build includes debug information (well, obiously...), which allows for runtime observation of data flow in the program and provides runtime feedback and checks on/of variable values, errors and allocations.The first practical difference that you're likely to encounter if you're not used to debugging is the fact that in debug mode, all variables are automatically initialized to some predefined non-null debug value and will thus halt execution if accessed (unless you initialize them properly), whereas in release mode the value of a variable may be undefined and may (but always won't, depending on the code) cause the program to act strangely or just plain cause it to crash.edit: in some cases that which you desctribed can be caused by writing over array bounds elsewhere in the code. This can be very hard to catch, but will effectively write into unwanted memory space, causing data previously there to become corrupt.   ;Quote:Does anybody know the main diferences between release and debug? I have to say that my NodeName class has all the initialitations done.Initializations are pretty much is the main difference, and your problem is likely caused by them somewhere.  Make sure you also check your copy constructors, assignment operators, and <operators because std::map probably uses them.tj963   ;  Thanks but those were the first things I check when I saw the problem, I ensure all variables where initialized and check there were no memory writing out of bounds.So the problem has to be more complicated, I've been programing complex application in C++ the last 8 years and never found a problem like that one.It's the first time I use a own-class key for a std::map so I guess the problem is related to how std::maps handle the keys (which operators it uses).   ;Quote:Make sure you also check your copy constructors, assignment operators, and <operators because std::map probably uses them.tj963No memory out of bound, no initializations forgotten.I overwritten the ones I put on my first post, just those ones. Maybe I need to overwriten something else.   ;  solved, stupid me, the < operator was wrong, inside my class there were an array and to check if one instance was bigger that another I compare every value inside the array, but the problem was that in debug the array was filled with 0, and in release not (I thought the initialization problem was only in variables, not arrays), so the values where diferent and so...thanks for those who helped me   