aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2021-10-21 21:22:09 -0700
committerMichael Forney <mforney@mforney.org>2021-10-21 21:22:09 -0700
commit028c7b12c1c6db2b7dc9c03650a169fbf8eaec70 (patch)
tree1825a64855432529c0571d83b508b4d6badd1419
parentf685cdc1cd6baa17879b15326f553409258d3f73 (diff)
Document the C23 features we implement
-rw-r--r--README.md5
-rw-r--r--doc/c23.md36
2 files changed, 39 insertions, 2 deletions
diff --git a/README.md b/README.md
index 8788e62..cb6c069 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@
`cproc` is a [C11] compiler using [QBE] as a backend. It is released
under the [ISC] license.
-Several GNU C [extensions] are also implemented.
+Some [C23 features] and [GNU C extensions] are also implemented.
There is still much to do, but it currently implements most of the
language and is capable of [building software] including itself, mcpp,
@@ -115,7 +115,8 @@ Patches are greatly appreciated. Send them to the mailing list
[QBE]: https://c9x.me/compile/
[C11]: http://port70.net/~nsz/c/c11/n1570.html
[ISC]: https://git.sr.ht/~mcf/cproc/blob/master/LICENSE
-[extensions]: https://man.sr.ht/~mcf/cproc/doc/extensions.md
+[C23 features]: https://man.sr.ht/~mcf/cproc/doc/c23.md
+[GNU C extensions]: https://man.sr.ht/~mcf/cproc/doc/extensions.md
[building software]: https://man.sr.ht/~mcf/cproc/doc/software.md
[8cc]: https://github.com/rui314/8cc
[c]: https://github.com/andrewchambers/c
diff --git a/doc/c23.md b/doc/c23.md
new file mode 100644
index 0000000..d91a40f
--- /dev/null
+++ b/doc/c23.md
@@ -0,0 +1,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