Loading...
Searching...
No Matches
stdio wrapper for AVR8

This module a wrapper for the stdio.h header intended to make use of flash_utils.h in printf() automatically. More...

Detailed Description

This module a wrapper for the stdio.h header intended to make use of flash_utils.h in printf() automatically.

Files

file  stdio.h
 stdio wrapper to extend the C libs stdio
 

Macros

#define printf(...)   /* implementation details */
 A wrapper for the printf() function that passes arguments through unmodified, but fails to compile if the first argument is not a string literal.
 

Macro Definition Documentation

◆ printf

#define printf (   ...)    /* implementation details */

A wrapper for the printf() function that passes arguments through unmodified, but fails to compile if the first argument is not a string literal.

See e.g. man 3 printf or https://linux.die.net/man/3/printf for documentation the printf function. This applies fully here, as it passes through the arguments unmodified.

The motivation for enforcing the first argument to be a string literal is three-fold:

  1. It prevents security issues due format strings controlled by adversaries.
  2. It makes sure that modern C compilers that do understand format specifiers have knowledge of the format string and can verify that the other arguments match what is given via format string specifiers
  3. It allows to force the format string to flash even for Harvard architectures transparently

Similar wrappers are also in place for vprintf(), fprintf(), vfprintf(), snprintf(), vsnprintf().

Definition at line 60 of file stdio.h.