~mcf/cproc

#C23 status

cproc implements many C23 features, but some are still not implemented (notably, constexpr, auto, and #embed).

TODO: Check implications of N2838, N2819, and N2836.

#Implemented

#N2265: _Static_assert without message

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

#N2335: Attributes

C23 introduces attribute syntax that can appear in many different locations, affecting various entities. All the standard attributes can safely be ignored.

#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.

#N2432: Remove support for function definitions with identifier lists

C23 removes K&R syntax for function definitions. Function declarations without a parameter type list that are not part of a definition continue to work the same as before.

#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.

#N2510: Allow unnamed parameters in a function definition

C23 allows you to omit the name of a parameter in the prototype of a function definition that does not use that parameter.

#N2549: Binary integer constants

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

#N2594: Mixed wide string literal concatenation

C23 bans adjacent string literals with differing prefixes. However, it is still valid to concatenate unprefixed literals with prefixed literals.

#N2626: Digit separators

C23 allows you to use ' to separate digits in all integer and floating constants.

#N2763: Adding a fundamental type for N-bit integers

C23 introduces a new family of types _BitInt(N), referred-to as bit-precise integer types. These types have the given width and use special integer promotion rules. Their conversion rank follows from their width, except that the rank order between a bit-precise type and a standard type with the same width is implementation-defined

#N2775: Literal suffixes for bit-precise integers

C23 adds a new suffix, wb or WB, to write integer constants with bit-precise integer types introduced in N2763. The width of the bit-precise integer type chosen is the minimum required to represent the constant (taking into account the sign bit). Unlike standard integer constants, the signedness of the integer type does not depend whether the constant is written in decimal or not. Constants with suffix uwb are always unsigned, and constants with suffix wb are always signed.

#N2778: Require variably-modified types

C99 first introduces VLAs, but they were made optional in C11. In C23, it is optional to support stack-allocated VLAs, but variably-modified types (those involving VLAs, such as a pointer to a VLA) must be supported.

#N2841: No function declarators without prototypes
#N2900: Consistent, warningless, and intuitive initialization with {}

C23 allows empty initializers to initialize an object as if it had static storage duration.

#N2927: Not-so-magic typeof for C

C23 adds the typeof(E) type specifier to specify type of expression E. Arrays and function designator expressions do not decay into pointers, just like when used with sizeof. You can use a typename with typeof to specify that same type.

C23 also introduces typeof_unqual, which behaves the same as typeof except that the specified type is unqualified.

#N2934: Revise spelling of keywords

C11 used the reserved namespace of identifiers beginning with _ and a capital letter for new keywords _Alignas, _Alignof, _Bool, _Static_assert, and _Thread_local.

C23 reservers new identifiers with more natural spelling: alignas, alignof, bool, static_assert, thread_local.

#N2935: Make false and true first-class language features

C23 introduces new keywords for true and false, referring to predefined constants for 1 and 0 respectively. These constants now have type bool instead of int.

#N2969: Bit-precise bit-fields
#N2975: Relax requirements for variadic parameter lists

C23 allows variadic functions with no named parameters. The second argument to the va_arg macro is now optional and is only used for backwards compatibility.

#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: Enhancements to 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.

#N3042: Introduce the nullptr constant

#Not implemented

#N2553: Querying attribute support

C23 introduced __has_c_attribute in preprocessor conditionals to query the support of a particular attribute.

#N2607: Compatibility of pointers to arrays with qualifiers

C23 array types always have the same qualifiers (except for _Atomic) as their element type. This ensures that the normal rules of qualifiers during pointer assignment work for array types. In other words, const int (*p)[2] = (int (*)[2])0; should work the same way as const int *p = (int *)0;.

#N2645: Add support for preprocessing directives #elifdef and #elifndef

C23 adds new preprocessing directives as a short-hand for #elif defined(...) and #elif !defined(...).

#N2764: The _Noreturn attribute

C11 first introduced _Noreturn as a function specifier. C23, with the introduction of attributes, adds this as an attribute, and deprecates the function-specifier.

#N3007: Type inference for object definitions
#N3017: Preprocessor #embed
#N3018: The constexpr specifier for object definitions
#N3033: Comma omission and comma deletion
#N3037: Improved rules for tag compatibility
#N3038: Storage-class specifiers for compound literals

About this wiki

commit d1c53ddf56571573a7025324c8dd5c6d547a4d1f
Author: Michael Forney <[email protected]>
Date:   2026-04-27T00:23:24-07:00

qbe: Use extern for globals with external linkage
Clone this wiki ("master" branch)
https://git.sr.ht/~mcf/cproc (read-only)
[email protected]:~mcf/cproc (read/write)