Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Do not use the sizeof() operator
#3
William Forbes Wrote:The definition of "byte" is defined in clause 3.4 of ISO/IEC 9899:1990
Basically, a byte is the size of a character. If a character is 16 bits then a byte is 16 bits.
Thus in my view, the implementation is compliant and the C standard is not ambiguous in this respect.
A byte is not always 8 bits.

Question: Is there a difference between C90 and C99 in this case? C99 (3.6) defines a byte as:

"addressable unit of data storage large enough to hold any member of the basic character set of the execution environment"

This is a very good definition, since the basic character set == the standard 7-bit ASCII. In reality this means 8 bits, ISO C
explicitly makes a difference between basic and extended character sets. So we can be certain that a byte is always 8 bits in C99.
Can anyone cite C90 in this case?

Also, C99 explicitly defines a char as 8 bits. The char type can never have any other size by that standard.

The question is what ISO C 1990 defines the size of a char as. This should be written in the Annex "Implementation Limits".
<t></t>
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)