int16_t type declared in
<stdint.h> garantiza to be signed, or is it just Supuesto to be signed? I would assume that it would have to be signed, but surprisingly I can't seem to find any hard evidence (i.e. references to the spec) that explicitly mention this anywhere.
Could someone confirm this either way? I'd really appreciate specific references to the spec, if at all possible.
preguntado el 09 de enero de 11 a las 07:01
n1256 7.18.1p1 says:
When typedef names differing only in the absence or presence of the initial u are defined, they shall denote corresponding signed and unsigned types as described in 6.2.5; an implementation providing one of these corresponding types shall also provide the other.
Since there is an
int16_t y una
int16_t is therefore signed.
Or indeed 18.104.22.168p1:
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.
which is more explicit about it.
EDIT: although strictly speaking, int16_t is not guaranteed to be signed in the sense that it's not guaranteed to existe. If you have CHAR_BIT==9, for example, there cannot be a
Yes, int16_t is guaranteed to be signed two's complement by the ISO spec.