Bit shift compiler bug or a corner case?-Collection of common programming errors
The following code outputs 0,1,32,33. Which is counter intuitive to say the least. But if I replace the literal 1 with the type annonated constant “ONE”, the loop runs fine.
This is with gcc 4.6.2 and -std=c++0x.
#include
#include
using namespace std;
int main()
{
int64_t bitmask = 3;
int64_t k;
const int64_t ONE = 1;
cout
Originally posted 2013-11-09 21:07:19.