Re: stdint.h and portability
- From: rlb@xxxxxxxxxxxxxxxxxxxxxx (Richard Bos)
- Date: Tue, 28 Feb 2006 15:01:15 GMT
"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.
What happens in that case?
They aren't there, and you can use #ifdef INT64_MIN (for example) to
test this. If the implementation provides these optional exact-width
typedefs, it must also #define these macros in <stdint.h>; if it does
not provide a typedef, it must not #define the corresponding macro.
Or you could use (u)int_leastN_t or (u)int_fastN_t, which are required
to exist for N equals 8, 16, 32 and 64, regardless of which other types
exist.
Richard
.
- Follow-Ups:
- Re: stdint.h and portability
- From: Keith Thompson
- Re: stdint.h and portability
- From: copx
- Re: stdint.h and portability
- References:
- stdint.h and portability
- From: copx
- stdint.h and portability
- Prev by Date: Re: private functions inside a function
- Next by Date: Re: Help in c pointers
- Previous by thread: Re: stdint.h and portability
- Next by thread: Re: stdint.h and portability
- Index(es):
Relevant Pages
|