![]() |
CITS2002 Systems Programming |
← prev | next → | ![]() |
![]() |
|||
Employing the correct sized integers for portability, continuedWhile the C99 and C11 <stdint.h> header file defines the datatypes, it doesn't define how we may perform input and output on them, independent of their actual storage size. C99 further standardized the new header file <inttypes.h> to achieve this.When using standard C functions like printf() and sscanf(), we can employ C's ability for the compiler (i.e. at compile-time, not run-time) to concatenate string constants. Within the <inttypes.h> header file, PRIi64 may be, for example, defined as the string "i" or "li" depending on the target environment's architecture:
Similar support exists within the C99 and C11 standards for varying sized pointers (typically 32- or 64-bits), the ability to perform I/O on their character (string) representations, and to select the appropriate sized integer so that it may hold a pointer value.
CITS2002 Systems Programming, Lecture 22, p8, 16th October 2023.
|