//
// This short test attempts to discover how the Visual Studio debugger and WinDbg handle
// for-loops and local variables.
//

int main()
{
	for (int i = 0; i < 1; ++i)
		int foo = 0;

	for (int i = 0; i < 1; ++i)
		int foo = 0;

	int i = 1;

	// Here, we have three i's and two foo's in the Locals window


	// 
	// Wrapping the variables in brackets, { and }, causes the debugger to hide 'bar'
	// from the Locals window once they go out of scope
	//
	for (int j = 0; j < 1; ++j)
	{
		int bar = 0;
	}

	for (int j = 0; j < 1; ++j)
	{
		int bar = 0;
	}

	// Here, we have two j's, but no bar's in the Locals window


	// While-loops are correctly handled by the Visual Studio debugger
	int k = 1;
	while (k-- != 0)
		int moo = 0;

	// Here, moo is correctly hidden whenever the while-loop exits (both in WinDbg and the Visual Studio debugger).
	// Executing 'dv moo' here yields nothing in WinDbg since 'moo' no longer exists


	return 0;
}
