When answering a comment to another answer of mine here, I found what I think may be a hole in the C standard (c1x, I haven\'t checked the earlier ones and yes, I k
In a 16-bit char environment malloc(10 * sizeof(char)) will allocate 10 chars (10 bytes), because if char is 16 bits, then that architecture/implementation defines a byte as 16 bits. A char isn't an octet, it's a byte. On older computers this can be larger than the 8 bit de-facto standard we have today.
The relevant section from the C standard follows:
3.6 Terms, definitions and symbols
byte - addressable unit of data storage large enough to hold any member of the basic character set of the execution environment...
NOTE 2 - A byte is composed of a contiguous sequence of bits, the number of which is implementation-defined.