4 ms·
Nope, the C standard requires that sizeof char = 1, regardless of the width of a byte :-).
by alxlaz 8y ago
Nope, the C standard requires that sizeof char = 1, regardless of the width of a byte :-).
- jstimpfle 8y agoOne of the things I was not sure about is whether the size of uint8_t is guaranteed to be 1 as well. And whether that means the both are pointer-compatible. And if so, where is this specified?
- alxlaz 8y agoAs far as I know, C99 makes no requirements about the byte width of int8_t, only about its bit width. The relevant bits are in section 7.18.1.1 . There are few architectures and runtimes where this is relevant anymore, and the answer is really best given on a case-by-case basis. I think it's technically possible to make the two pointer-compatible on architectures with wider bytes. Last time I used one it was Analog Devices' SHARC, and I think they were pointer-compatible, but that was a long time ago, so take it with a grain of salt.