4 ms·
To clarify, only signed integer overflow is undefined behavior in C. Unsigned integers have wrap-around semantics. (But beware that unsigned integers smaller th
by jwilk 9y ago
To clarify, only signed integer overflow is undefined behavior in C. Unsigned integers have wrap-around semantics. (But beware that unsigned integers smaller than int could be automatically promoted to (signed) int!)
- RealityVoid 9y agoThis should be higher up since it's a tiny but important distinction.
- chewbacha 9y ago> (But beware that unsigned integers smaller than int could be automatically promoted to (signed) int!) This caveat sounds an awful lot like undefined behavior ;p
- gpm 9y agoWhen things are promoted is well defined, just subtle behavior.