What is going on with bitwise operators and integer promotion?

[expr.unary.op] The operand of ~ shall have integral or unscoped enumeration type; the result is the one’s complement of its operand. Integral promotions are performed. [expr.shift] The shift operators << and >> group left-to-right. […] The operands shall be of integral or unscoped enumeration type and integral promotions are performed. What’s the integral promotion of uint8_t … Read more

What is the use of intptr_t?

The primary reason, you cannot do bitwise operation on a void *, but you can do the same on a intptr_t. On many occassion, where you need to perform bitwise operation on an address, you can use intptr_t. However, for bitwise operations, best approach is to use the unsigned counterpart, uintptr_t. As mentioned in the … Read more