c99

Are there machines, where sizeof(char) != 1, or at least CHAR_BIT > 8?

元气小坏坏 提交于 2019-11-25 22:33:44
问题 Are there machines (or compilers), where sizeof(char) != 1 ? Does C99 standard says that sizeof(char) on standard compliance implementation MUST be exactly 1? If it does, please, give me section number and citation. Update: If I have a machine (CPU), which can\'t address bytes (minimal read is 4 bytes, aligned), but only 4-s of bytes ( uint32_t ), can compiler for this machine define sizeof(char) to 4? sizeof(char) will be 1, but char will have 32 bits ( CHAR_BIT macros) Update2: But sizeof

What is the behavior of integer division?

限于喜欢 提交于 2019-11-25 21:38:33
问题 For example, int result; result = 125/100; or result = 43/100; Will result always be the floor of the division? What is the defined behavior? 回答1: Will result always be the floor of the division? What is the defined behavior? Yes, integer quotient of the two operands. 6.5.5 Multiplicative operators 6 When integers are divided, the result of the / operator is the algebraic quotient with any fractional part discarded. 88) If the quotient a/b is representable, the expression (a/b)*b + a%b shall