I scratched my head: I have an application that works fine in Debug + Release, if it started with Visual Studio 2010, both in Debug and in "Run without Debugging". If I run the same application from the command line with the same settings, I see a different behavior. In particular, code that works differently:
const List& vl = nDesc.Get<List> ("slots");
int index = 0;
for (auto it = vl.begin (), end = vl.end (); it != end; ++it)
{
desc.units [index++] = Parse (Tree (*it));
}
I would suggest that the state of the race, but the code is completely single-threaded. It is interesting to note that adding some random code does not make it work (i.e. just writing a line is not enough). Oh, and this loop only starts once, ever.
The data in desc is the same, uploading it to a file after the loop indicates that the same data was written. Moving the loop up and down around this piece of code does not help; also does not change auto to List :: const_iterator help.
Any ideas you can start debugging with?
[Update] Turning off optimizations of this function does not fix it for Release, but I can attach a debugger and see that everything works there as expected. But I do not get the correct program behavior. Stills works with Run without Debugging and Run with Debug.
source
share