by fshaun · 8y ago · 0 comments
A proper abstraction is the one where you specify both the size and the endianness at the point where you extract the value - i.e. where you just call a function like read_int16_be(byte_stream).
That isn't guaranteed. sizeof(short) and sizeof(int) are both allowed to be 1 on a system with chars at least 16 or 32 bits wide, respectively.
Which just goes to show that these are not the types you want to be using for any kind of portable binary I/O.