I had a boolean that needs to be flipped each time its used, since the code was rather simple every other line was me flipping the boolean. I fiddled around a little and came up with this (even more simplified example)
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
bool flippy = 0;
cout << (flippy = !flippy) << "\n";
cout << (flippy = !flippy) << "\n";
cout << (flippy = !flippy) << "\n";
cout << (flippy = !flippy) << "\n";
system("PAUSE");
return 0;
}
It produces 1 0 1 0 as expected but looks a bit odd, is this valid use of the language?