5.7.1.23 Smart-io Option

The -msmart-io=level option in conjunction with the IO format string conversion specifications detected in your program control the feature set (hence size) of the library code that is linked in to perform formatted IO through functions like printf. See 19.1 Smart IO Routines for more information on how the smart IO feature operates.

A numerical level of operation can be specified and these have the meaning shown in the following table.
Table 5-5. Smart IO Implementation Levels
Level Smart IO features; linked library
0 Disabled; Full-featured library (largest code size)
1 Enabled; Minimal-featured library (smallest code size)
2 Manual control; Integer-only library

When the smart IO feature is disabled (-msmart-io=0), a full implementation of the IO functions will be linked into your program. All features of the IO library functions will be available, and these may consume a significant amount of the available program and data memory on the target device.

The default setting is for smart IO to be enabled with a minimal feature set. This can be made explicit by using either the -msmart-io=1 or -msmart-io option. When thus enabled, the compiler will link in the least complex variant of the IO library that implements all of the IO functionality required by the program, based on the conversion specifications detected in the program's IO function format strings. This can substantially reduce the memory requirements of your program, especially if you can eliminate in your program the use of floating-point features.

If the format string in a call to an IO function is not a string literal, the compiler will not be able to detect the exact usage of the IO function and a full-featured variant of the IO library will be linked into the program image, even with smart IO enabled.

These options should be used consistently across all program modules to ensure an optimal selection of the library routines included in the program image.