Skip to content

Commit ced7254

Browse files
committed
README tweaks
1 parent 2a742c1 commit ced7254

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

README.md

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -162,21 +162,21 @@ The following format specifiers are supported:
162162

163163
#### Types
164164

165-
| Type | Output |
166-
|--------|--------|
167-
| d or i | Signed decimal integer |
168-
| u | Unsigned decimal integer |
169-
| b | Unsigned binary |
170-
| o | Unsigned octal |
171-
| x | Unsigned hexadecimal integer (lowercase) |
172-
| X | Unsigned hexadecimal integer (uppercase) |
173-
| f or F | Decimal floating point |
174-
| e or E | Scientific-notation (exponential) floating point |
175-
| g or G | Scientific or decimal floating point |
176-
| c | Single character |
177-
| s | String of characters |
178-
| p | Pointer address |
179-
| n | None; number of characters produced so far written to argument pointer |
165+
| Type | Output |
166+
|------------|--------------------------|
167+
| `d` or `i` | Signed decimal integer |
168+
| `u` | Unsigned decimal integer |
169+
| `b` | Unsigned binary |
170+
| `o` | Unsigned octal |
171+
| `x` | Unsigned hexadecimal integer (lowercase) |
172+
| `X` | Unsigned hexadecimal integer (uppercase) |
173+
| `f` or `F` | Decimal floating point |
174+
| `e` or `E` | Scientific-notation (exponential) floating point |
175+
| `g` or `G` | Scientific or decimal floating point |
176+
| `c` | Single character |
177+
| `s` | String of characters |
178+
| `p` | Pointer address |
179+
| `n` | None; number of characters produced so far written to argument pointer |
180180

181181
Notes:
182182

@@ -186,57 +186,57 @@ Notes:
186186

187187
#### Flags
188188

189-
| Flags | Description |
190-
|-------|-------------|
191-
| - | Left-justify within the given field width; Right justification is the default. |
192-
| + | Forces to precede the result with a plus or minus sign (+ or -) even for positive numbers.<br>By default, only negative numbers are preceded with a - sign. |
189+
| Flags | Description |
190+
|---------|-------------|
191+
| `-` | Left-justify within the given field width; Right justification is the default. |
192+
| `+` | Forces to precede the result with a plus or minus sign (+ or -) even for positive numbers.<br>By default, only negative numbers are preceded with a - sign. |
193193
| (space) | If no sign is going to be written, a blank space is inserted before the value. |
194-
| # | Used with o, b, x or X specifiers the value is preceded with 0, 0b, 0x or 0X respectively for values different than zero.<br>Used with f, F it forces the written output to contain a decimal point even if no more digits follow. By default, if no digits follow, no decimal point is written. |
195-
| 0 | Left-pads the number with zeros (0) instead of spaces when padding is specified (see width sub-specifier). |
194+
| `#` | Used with o, b, x or X specifiers the value is preceded with 0, 0b, 0x or 0X respectively for values different than zero.<br>Used with f, F it forces the written output to contain a decimal point even if no more digits follow. By default, if no digits follow, no decimal point is written. |
195+
| `0` | Left-pads the number with zeros (0) instead of spaces when padding is specified (see width sub-specifier). |
196196

197197

198198
#### Width Specifiers
199199

200200
| Width | Description |
201201
|----------|-------------|
202202
| (number) | Minimum number of characters to be printed. If the value to be printed is shorter than this number, the result is padded with blank spaces. The value is not truncated even if the result is larger. |
203-
| * | The width is not specified in the format string, but as an additional integer value argument preceding the argument that has to be formatted. |
203+
| `*` | The width is not specified in the format string, but as an additional integer value argument preceding the argument that has to be formatted. |
204204

205205

206206
#### Precision Specifiers
207207

208-
| Precision | Description |
209-
|-----------|-------------|
210-
| .number | For integer specifiers (d, i, o, u, x, X): precision specifies the minimum number of digits to be written. If the value to be written is shorter than this number, the result is padded with leading zeros. The value is not truncated even if the result is longer. A precision of 0 means that no character is written for the value 0.<br>For f and F specifiers: this is the number of digits to be printed after the decimal point. **By default, this is 6, and a maximum is defined when building the library**.<br>For s: this is the maximum number of characters to be printed. By default all characters are printed until the ending null character is encountered.<br>If the period is specified without an explicit value for precision, 0 is assumed. |
211-
| .* | The precision is not specified in the format string, but as an additional integer value argument preceding the argument that has to be formatted. |
208+
| Precision | Description |
209+
|-------------|-------------|
210+
| `.`(number) | For integer specifiers (d, i, o, u, x, X): precision specifies the minimum number of digits to be written. If the value to be written is shorter than this number, the result is padded with leading zeros. The value is not truncated even if the result is longer. A precision of 0 means that no character is written for the value 0.<br>For f and F specifiers: this is the number of digits to be printed after the decimal point. **By default, this is 6, and a maximum is defined when building the library**.<br>For s: this is the maximum number of characters to be printed. By default all characters are printed until the ending null character is encountered.<br>If the period is specified without an explicit value for precision, 0 is assumed. |
211+
| `.*` | The precision is not specified in the format string, but as an additional integer value argument preceding the argument that has to be formatted. |
212212

213213

214214
#### Length modifiers
215215

216216
The length sub-specifier modifies the length of the data type.
217217

218-
| Length | With `d`, `i` | With `u`,`o`,`x`, `X` | Support enabled by... |
219-
|--------|---------------------------|------------------------|---------------------------------------|
220-
| (none) | int | unsigned int | |
221-
| hh | signed char | unsigned char | |
222-
| h | short int | unsigned short int | |
223-
| l | long int | unsigned long int | |
224-
| ll | long long int | unsigned long long int | PRINTF_SUPPORT_LONG_LONG |
225-
| j | intmax_t | uintmax_t | |
226-
| z | signed version of size_t | size_t | |
227-
| t | ptrdiff_t | ptrdiff_t | |
228-
| I8 | int8_t | uint8_t | SUPPORT_MSVC_STYLE_INTEGER_SPECIFIERS |
229-
| I16 | int16_t | uint16_t | SUPPORT_MSVC_STYLE_INTEGER_SPECIFIERS |
230-
| I32 | int32_t | uint32_t | SUPPORT_MSVC_STYLE_INTEGER_SPECIFIERS |
231-
| I64 | int64_t | uint64_t | SUPPORT_MSVC_STYLE_INTEGER_SPECIFIERS |
218+
| Length | With `d`, `i` | With `u`,`o`,`x`, `X` | Support enabled by... |
219+
|----------|-----------------------------|--------------------------|---------------------------------------|
220+
| (none) | `int` | `unsigned int` | |
221+
| `hh` | `signed char` | `unsigned char` | |
222+
| `h` | `short int` | `unsigned short int` | |
223+
| `l` | `long int` | `unsigned long int` | |
224+
| `ll` | `long long int` | `unsigned long long int` | PRINTF_SUPPORT_LONG_LONG |
225+
| `j` | `intmax_t` | `uintmax_t` | |
226+
| `z` | signed version of `size_t` | `size_t` | |
227+
| `t` | `ptrdiff_t` | `ptrdiff_t` | |
228+
| `I8` | `int8_t` | `uint8_t` | SUPPORT_MSVC_STYLE_INTEGER_SPECIFIERS |
229+
| `I16` | `int16_t` | `uint16_t` | SUPPORT_MSVC_STYLE_INTEGER_SPECIFIERS |
230+
| `I32` | `int32_t` | `uint32_t` | SUPPORT_MSVC_STYLE_INTEGER_SPECIFIERS |
231+
| `I64` | `int64_t` | `uint64_t` | SUPPORT_MSVC_STYLE_INTEGER_SPECIFIERS |
232232

233233

234234
Notes:
235235

236236
* The `L` modifier, for `long double`, is not currently supported.
237237
* A `"%zd"` or `"%zi"` takes a signed integer of the same size as `size_t`.
238238
* The implementation currently assumes each of `intmax_t`, signed `size_t`, and `ptrdiff_t` has the same size as `long int` or as `long long int`. If this is not the case for your platform, please open an issue.
239-
* The `Ixx` length modifiers are not in the C (nor C++) standard, but are somewhat popular, as it makes it easier to handle integer types of specific size. One must specify the argument size in bits immediately after the `I`. The printing is "integer-promotion-safe", i.e. the fact that an `int8_t` may actually be passed in promoted into a larger `int` will not prevent it from being printed using its origina value.
239+
* The `Ixx` length modifiers are not in the C (nor C++) standard, but are somewhat popular, as it makes it easier to handle integer types of specific size. One must specify the argument size in bits immediately after the `I`. The printing is "integer-promotion-safe", i.e. the fact that an `int8_t` may actually be passed in promoted into a larger `int` will not prevent it from being printed using its original value.
240240

241241
### Return Value
242242

0 commit comments

Comments
 (0)