Next: Checking Integer Overflow, Previous: Arithmetic Type Properties, Up: Integer Properties [Contents][Index]

`INT_BUFSIZE_BOUND (`

is an integer constant
expression that is a bound on the size of the string representing an
integer type or expression `t`)`t` in decimal notation, including the
terminating null character and any leading `-`

character. For
example, if `INT_BUFSIZE_BOUND (int)`

is 12, any value of type
`int`

can be represented in 12 bytes or less, including the
terminating null. The bound is not necessarily tight.

Example usage:

#include <intprops.h> #include <stdio.h> int int_strlen (int i) { char buf[INT_BUFSIZE_BOUND (int)]; return sprintf (buf, "%d", i); }

`INT_STRLEN_BOUND (`

is an integer constant
expression that is a bound on the length of the string representing an
integer type or expression `t`)`t` in decimal notation, including any
leading `-`

character. This is one less than
`INT_BUFSIZE_BOUND (`

.
`t`)

`TYPE_MINIMUM (`

and `t`)`TYPE_MAXIMUM (`

are
integer constant expressions equal to the minimum and maximum
values of the integer type `t`)`t`. These expressions are of the type
`t` (or more precisely, the type `t` after integer
promotions).

Example usage:

#include <stdint.h> #include <sys/types.h> #include <intprops.h> int in_off_t_range (intmax_t a) { return TYPE_MINIMUM (off_t) <= a && a <= TYPE_MAXIMUM (off_t); }