3 ms·
> Currently, the code could be written with normal overloading (one for int and one for unsigned). No traits required f( (uint8_t)0 ) will dispatch to the over
by edflsafoiewq 7y ago
> Currently, the code could be written with normal overloading (one for int and one for unsigned). No traits required
f( (uint8_t)0 ) will dispatch to the overload f(int) with overloads. The type-trait code will dispatch to f_unsigned(unsigned).
- dirtydroog 7y agoI didn't believe you but you're right. The uint8_t gets promoted to int, not unsigned int. https://godbolt.org/z/icQHw3 https://godbolt.org/z/icQHw3
- saagarjha 7y agoC’s integer promotion rules aren’t the best.