You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+41-41Lines changed: 41 additions & 41 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -162,21 +162,21 @@ The following format specifiers are supported:
162
162
163
163
#### Types
164
164
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 |
180
180
181
181
Notes:
182
182
@@ -186,57 +186,57 @@ Notes:
186
186
187
187
#### Flags
188
188
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. |
193
193
| (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). |
196
196
197
197
198
198
#### Width Specifiers
199
199
200
200
| Width | Description |
201
201
|----------|-------------|
202
202
| (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. |
204
204
205
205
206
206
#### Precision Specifiers
207
207
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. |
212
212
213
213
214
214
#### Length modifiers
215
215
216
216
The length sub-specifier modifies the length of the data type.
217
217
218
-
| Length | With `d`, `i`| With `u`,`o`,`x`, `X`| Support enabled by... |
* The `L` modifier, for `long double`, is not currently supported.
237
237
* A `"%zd"` or `"%zi"` takes a signed integer of the same size as `size_t`.
238
238
* 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.
0 commit comments