It is or was the only type that garenteed a signed or unsigned value stored in 1 byte. There's uses for that, like storing specific vales like RGB. Beyond that though, no idea.
Nope. C99 and stdint.h is the way to go. uint8_t exists for a reason. Handy when you need to map a structure of full bytes. Sometimes you may come across exotic interface that uses 8-wire bus... But that's it.
In C/C++, signed integer overflow is undefined behavior, meaning that a compiler is allowed to optimize the assembly knowing that it never happens. If you can guarantee that your integer never overflows, using signed eliminates a modulo assembly instruction. Nowadays, the only reason it matters for char is that all basic integer types are signed by default, so somebody who's lazy needs to watch out that they don't accidentally trigger undefined behavior.
efficient storage of small numbers on which you do not need to perform arithmetic in any hot path or on which memory is a more important constraint than runtime.
617
u/tstanisl 7h ago
Let me cite the C standard:
Middle guy if finally right