Re: stdint.h and portability
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Tue, 28 Feb 2006 21:59:08 GMT
rlb@xxxxxxxxxxxxxxxxxxxxxx (Richard Bos) writes:
"copx" <invalid@xxxxxxxxxxx> wrote:
I wonder how portable the exact width types defined by stdint.h
are. I guess target platforms are not required to actually have all
those types, right?
Right. Except that if an implementation provides an (unsigned) integer
type of 8, 16, 32 or 64 bits, no matter what it is or how it is named,
it must also provide the corresponding (u)intN_t typedef in <stdint.h>.
If it does not otherwise provide a particular size integer, it needn't
define the typedef, and typedefs of any other size are completely
optional.
The {,u}int_{8,16,32,64}_t types are required only if the
implementation provides types of the specified sizes with no padding
bits (and for the signed types, with a two's complement
representation). If an implementation has a 32-bit signed integer
type with no padding bits, but its representation is one's-complement,
int32_t won't be defined (unless there's *also* a two's-complement
type).
The {,u}int_least{8,16,32,64}_t types and the
{,u}int_fast{8,16,32,64}_t type are required.
Types with sizes other than 8, 16, 32, and 64 are optional (and likely
to be rare).
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.
- References:
- stdint.h and portability
- From: copx
- Re: stdint.h and portability
- From: Richard Bos
- stdint.h and portability
- Prev by Date: Re: a question of style
- Next by Date: Re: malloc behavior on failure
- Previous by thread: Re: stdint.h and portability
- Next by thread: Printing Patterns using for loops
- Index(es):
Relevant Pages
|