Specifications

CAVR-4
Part 1. Using the compiler
The DLIB runtime environment
59
Choosing formatters for printf and scanf
To override the default formatter for all the printf- and scanf-related functions,
except for wprintf and wscanf variants, you simply set the appropriate library
options. This section describes the different options available.
Note:
If you rebuild the library, it is possible to optimize these functions even further,
see Configuration symbols for printf and scanf, page 69
For information about how to choose formatter for the AVR-specific functions
printf_P and scanf_P, see AVR–specific library functions, page 249.
CHOOSING PRINTF FORMATTER
The printf function uses a formatter called _Printf. The default version is quite
large, and provides facilities not required in many embedded applications. To reduce the
memory consumption, three smaller, alternative versions are also provided in the
standard C/EC++ library.
The following table summarizes the capabilities of the different formatters:
* Depends on which library configuration is used.
Formatting capabilities _PrintfFull _PrintfLarge
_PrintfSmall
(default)
_PrintfTiny
Basic specifiers c, d, i, o, p, s, u, X,
x, and %
Ye s Ye s Ye s Ye s
Multibyte support * * * No
Floating-point specifiers a, and A Ye s N o N o No
Floating-point specifiers e, E, f, F, g,
and G
Ye s Ye s N o N o
Conversion specifier n Ye s Ye s N o N o
Format flag space, +, -, #, and 0 Ye s Ye s Yes N o
Length modifiers h, l, L, s, t, and Z Ye s Ye s Ye s N o
Field width and precision, including * Ye s Ye s Ye s N o
long long support Yes Yes No No
Table 17: Formatters for printf