Re: Anyone object to the following change in libc?

From: Stefan Farfeleder <stefan_at_fafoe.narf.at>
Date: Fri, 31 Oct 2003 18:20:17 +0100
On Fri, Oct 31, 2003 at 04:43:37PM +0100, Erik Trulsson wrote:

> Perhaps not smaller in terms of the sizeof operator, but why can't one
> have a 16-bit char, and an int8_t which occupies 16 bits, but only uses
> 8 of them - the other 8 being padding?

7.18.1.1 Exact-width integer types

1 The typedef name intN_t designates a signed integer type with width N, no padding
  bits, and a two's complement representation. Thus, int8_t denotes a signed integer
  type with a width of exactly 8 bits.

> Where in C99 does it say that uint8_t can't have padding bits?
> I can't find anything in n869.txt to that effect.
> As far as I can tell, the only type that is not allowed to have any
> padding bits or trap representations is unsigned char.

uint8_t is int8_t's corresponding unsigned type.  This means
sizeof(uint8_t) == sizeof(int8_t), thus uint8_t can't have padding bits
either.

Cheers,
Stefan
Received on Fri Oct 31 2003 - 08:20:24 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:27 UTC