System-derived types, such as size_t
, should be used where possible so that the resulting variables make sense when passed between functions. The new derived types uintptr_t
or intptr_t
should be used as the integral type for pointers.
Fixed-width integer types are useful for representing explicit sizes of binary data structures or hardware registers, while fundamental C language data types, such as int
, can still be used for loop counters or file descriptors.
Some system-derived types represent 32-bit quantities on a 32-bit system but represent 64-bit quantities on a 64-bit system. Derived types that change size in this way include: clock_t
, daddr_t
, dev_t
, ino_t
, intptr_t
, off_t
, size_t
, ssize_t
, time_t
, uintptr_t
, and timeout_id_t
.
Drivers that use these derived types should pay particular attention to their use, particularly if they are assigning these values to variables of another derived type, such as a fixed-width type.