|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
random_shuffle behavior differs, VS 2003 versus VS 2005release executables when compiled with /clr This console app, built without /clr using VS 2005, produces identical results for debug and release executables. But add /clr to the compile line and two different results occur. The debug result matches that of the "non-clr" executables. This poses a serious problem for QC of mixed-mode applications built with VS 2005. Lack of reproducibility of release executable behavior in a debugging environment is unacceptable. This discrepancy has not been observed using VS 2003. Will this behavior be fixed in a future release of VS 2005? // Shuffling.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> // C++ STL cout, endl #include <numeric> // C++ STL generic numeric algorithms (partial_sum) #include <queue> // Standard C++ Library queue using namespace std; int _tmain(int argc, _TCHAR* argv[]) { // create the deque (1, 2, ... 10) . . . std::deque<int> myDeque(10, 1); partial_sum(myDeque.begin(), myDeque.end(), myDeque.begin()); for (unsigned int i = 0; i < myDeque.size(); ++i) { cout << myDeque[i] << ' '; } cout << endl; // . . . and randomize it random_shuffle (myDeque.begin(), myDeque.end()); for (unsigned int i = 0; i < myDeque.size(); ++i) { cout << myDeque[i] << ' '; } cout << endl; getchar(); exit(0); } Debug (no /clr) 1 2 3 4 5 6 7 8 9 10 9 2 10 3 1 6 8 4 5 7 Release (no /clr) 1 2 3 4 5 6 7 8 9 10 9 2 10 3 1 6 8 4 5 7 Debug /clr 1 2 3 4 5 6 7 8 9 10 9 2 10 3 1 6 8 4 5 7 Release /clr 1 2 3 4 5 6 7 8 9 10 10 1 9 2 4 8 5 6 7 3 |
|||||||||||||||||||||||