Open
Description
Source
Specification
Source: https://en.wikipedia.org/wiki/Printf_format_string#Format_placeholder_specification
- syntax for a format placeholder:
%[parameter][flags][width][.precision][length]type
To keep things simple we can go with the subset of the following options to build an minimum viable product
- Type field:
- '%'
- 'd' 'i'
- 'u'
- 'f' 'F'
-
'g' 'G' - 'x' 'X'
- 'o'
- 's'
- 'c'
- 'p'
- Length field:
- The field may be omitted (default, current behaviour)
- 'l': 4 bytes same as 'not-specified'
- 'll': 8 bytes
-
'L': 96 bits? or bits?- https://en.wikipedia.org/wiki/Long_double#Implementations
- https://godbolt.org/z/EME3zdcjG =>
12 bytes == 96 bits
- 'z': 4 bytes same as 'not-specified'
- Flags field:
- The field may be omitted (default, current behaviour)
- '-' minus
- '+' plus
- ' ' space
- '0'
- Width field:
- The field may be omitted (default, current behaviour)
- or a numeric integer value
- or a dynamic value when passed as another argument when indicated by an asterisk
*
.
- Precision field:
- The field may be omitted (default, current behaviour)
- or a numeric integer value
- or a dynamic value when passed as another argument when indicated by an asterisk
*
.
Multiple small pull requests are way better than one giant one :)