On Tue, Jul 12, 2005 at 09:44:09PM +0200, Alexander Strasser wrote:
> Felix Nawothnig wrote:
> > You can't have both a guaranteed size and guaranteed performance (while
> > being portable), so what would your proposed "int_fast32_t" be then?
>
> It's not my proposed type, this exists already I don't know if it is
> covered by C99 or not.
Yes, it's standard in C99 assuming you include <stdint.h>. For N = 8,
16, 32, and 64, C99 has these typedefs:
intN_t, uintN_t
Exact-width integers. The type has exactly N value bits.
These are required only if the implementation has an underlying
integer type of the proper size available.
int_leastN_t, uint_leastN_t
Minimum-width integers. The type will be the smallest type with
at least N value bits (but possibly more than N). These are
required.
int_fastN_t, uint_fastN_t
Fastest minimum-width integers. The type will be the "fastest"
(for all purposes, as decided by the implementation) type with
at least N value bits (but possibly more than N). These are
required.
C99 also standardizes:
intptr_t, uintptr_t
A void pointer converted to this integer type, then back to a void
pointer again, shall compare equal to the original pointer. These
are optional.
intmax_t, uintmax_t
Greatest-width integers. This type is capable of representing any
value of any integer type. These are required.
A related header is <inttypes.h>, which declares some string
conversion functions and provides format specifiers for the <stdint.h>
types. For example to print a uint32_t portably, you would do
something like this:
uint32_t x;
...
printf("%" PRIu32 "\n",x);
-Dave Dodge
_______________________________________________
Tinycc-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/tinycc-devel