Close

Design: Conversion Specifiers

A project log for reprint: modern printf

reprint is printf redone with decades of hindsight, revamping the semantics and syntax to make a function worthy of Hello World.

analog-twoAnalog Two 03/30/2016 at 16:400 Comments

Like printf, reprint also has conversion specifiers to control data formatting. The conversion specifier breaks down to the following parts

  1. Field Header: Indicates start of conversion specifier. The \f header starts a formatted specifier, while \b header starts a binary output specifier.
  2. Packing Directive: Specify whether source data is tightly packed or packed as a C struct.
  3. Output Control: Various parameters for controlling output.
  4. Input Specification: Various parameters for interpreting the input. At minimum there is a size specification, which terminates the conversion specifier.

The exact characters comprising these sections are shown in the ASCII table breakdown of the conversion specifier syntax.

Discussions