diff options
author | Michael Forney <mforney@mforney.org> | 2024-03-21 16:43:00 -0700 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2024-03-21 17:33:40 -0700 |
commit | d1d23429f5dc3d78b03b318a7d349ad71a6c97fa (patch) | |
tree | 072e44175ebd75970565e9eb3b893bada3bbdd2a /doc | |
parent | 8bed97beaea3839369a947ea741aa083e76ca014 (diff) |
decl: Add support for enums with large values and fixed underlying types
Fixes: https://todo.sr.ht/~mcf/cproc/64
Diffstat (limited to 'doc')
-rw-r--r-- | doc/c23.md | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -40,6 +40,28 @@ and hexadecimal, using syntax like `0b01101011`. C23 allows empty initializers to initialize an object as if it had static storage duration. +## [N3029]: Improved Normal Enumerations + +C23 allows enumerators outside the range of `int`. When an enum +type contains such an enumerator, its type during processing of the +enum is the type of the initializing expression, or the type of the +previous enumerator if there is no initializing expression. In the +latter case, if the type of the previous enumerator can't represent +the current value, an integer type with the same signedness capable +of representing the value is chosen. Outside of an enum containing +a large enumerator, the types of all enumerators are changed to the +the enum type. + +## [N3030]: Enhanced Enumerations + +C23 allows enum types with fixed underlying types using syntax like +`enum E : unsigned long`. These enum types are compatible with the +underlying type, and all enumerator constants have the enum type. + +Enum types with fixed underlying types are complete by the end of +the underlying type specifier, so they can be forward-declared and +used inside the enum. + [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 |