Follow

:C 

@amiloradovsky@functional.cafe 1 << 31 is undefined behavior if int is 32 bit. In general if you want bit manipulations you should do them with unsigned types, and take into account sizeof(T) and maybe even CHAR_BIT. A literal without suffix is int, because basic arithmetic is more useful and common than bit twiddling. int is supposed to be the natural word size of the machine so that your can be sure your basic arithmetic is efficient, but we are stuck with 32 bit even on 64 bit machines cause people didn't care and wrote broken not standard bit twiddles.

· · SubwayTooter · 0 · 0 · 0
Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.