3 ms·
Some people are pointing out undefined behavior involving shifts. I agree it's pretty egregious. (Also, how can you hardcode 31 in a bunch of places, make a s
by asveikau 13y ago
Some people are pointing out undefined behavior involving shifts. I agree it's pretty egregious. (Also, how can you hardcode 31 in a bunch of places, make a statement like "if you don't know how many bytes an int is" - and not mention sizeof!)
But there's a special place in hell reserved for this:
> (a) ^= (b) ^= (a) ^= (b);
This is undefined because ^= is not a sequence point.
I feel like the title of this should be "how to demonstrate lack of C knowledge".