aboutsummaryrefslogtreecommitdiff
path: root/doc/c23.md
blob: d91a40fffc2d85db0cd6465e5113fba413522358 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# C23 status

cproc implements some C23 features applied to the latest drafts.

## [N2265]: `_Static_assert` without message

C11 required that static assertions always contained a message. C23
now allows `_Static_assert` with just an expression.

## [N2418]: UTF-8 character constants

C23 introduces UTF-8 character constants using the syntax `u8'a'`.
Compared to an unprefixed character constant, they have type `unsigned
char` instead of `int`, and are guaranteed to use UTF-8 encoding
rather than the execution character set. Since the character in a
UTF-8 character constant must have a single-byte UTF-8 encoding,
this type of character constant could be useful when you need the
ASCII value of a character, but do not want to depend on any
particular execution character set.

## [N2508]: Free positioning of labels inside compound statements

In previous revisions of C, labels like `foo:`, `case 123:`, or
`default:` could only precede statements. This was relaxed in C23,
and they can now appear intermixed with declarations in compound
statements.

## [N2549]: Binary integer constants

C23 allows binary integer constants in addition to octal, decimal,
and hexadecimal, using syntax like `0b01101011`.

[N2265]: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2265.pdf
[N2418]: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2418.pdf
[N2508]: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2508.pdf
[N2549]: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2549.pdf