0

Does this depend on the C++ version, OS, and/or system architecture? Does long, long long, int, short, and even custom integer types from all/most packages, use the same sign system?

I am learning about shifting, masking, and other forms of bit-manipulation, so this will help.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • https://stackoverflow.com/questions/57363324/ramifications-of-c20-requiring-twos-complement – Hans Passant Nov 23 '22 at 20:17
  • 2
    Caution, that even though the two's complement is *now* guaranteed, you can still run afoul of **undefined behavior** with shifting. Best to do bit twiddling with unsigned integers. – Eljay Nov 23 '22 at 20:17
  • 3
    "*Does this depend on the C++ version, OS, and/or system architecture?*" - all of the above – Remy Lebeau Nov 23 '22 at 20:35

0 Answers0