Re: stdint.h and portability
- From: "copx" <invalid@xxxxxxxxxxx>
- Date: Tue, 28 Feb 2006 16:59:37 +0100
"Richard Bos" <rlb@xxxxxxxxxxxxxxxxxxxxxx> schrieb im Newsbeitrag
news:44046296.359587293@xxxxxxxxxxxxxxxxx
"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.
A very informative reply, thanks!
.
- References:
- stdint.h and portability
- From: copx
- Re: stdint.h and portability
- From: Richard Bos
- stdint.h and portability
- Prev by Date: Make fast money in the mail order buisness!
- Next by Date: Re: Help with C books
- Previous by thread: Re: stdint.h and portability
- Next by thread: Re: stdint.h and portability
- Index(es):
Relevant Pages
|