To: J3 J3/26-128r1 From: Malcolm Cohen Subject: Edits for C23 enum interoperability Date: 2026-February-26 Reference: 26-122r1, 26-007. 1. Introduction This paper has the edits to add interoperability with the new enum abilities in C23 (ISO/IEC-9899:2024). See 26-122r1 for background discussion, requirements, specifications and syntax. 2. Edits to 26-007 [76:26-27] 7.4.1 Classification and specification, C727 after R717 kind-selector, Delete "(R717)", After "of" insert "the", Before "shall be" insert "in a kind-selector", After "on the processor" insert "for the type being specified". That makes the whole constraint read: "The value of the scalar-int-constant-expr in a kind-selector shall be nonnegative and shall specify a representation method that exists on the processor for the type being specified." {This is just editorial. The existing text is not really wrong, but it makes the reader work harder than necessary.} [109:5-7] 7.6.1 Interoperable enumerations and enumtypes, R771 enum-def-stmt, in each production insert "[ \si{kind-selector} ]" after the keyword ENUM. {EDITOR: If that makes a line too long, consider using a narrower BNF macro.} [109:13+] Same subclause, after C7137 "An enum-type-name", insert constraint "C7137a If kind-selector appears in an enum-def-stmt of an enum-def, each named-constant in an \si{enumerator} of that definition shall have a value that is representable in the specified representation method." {Careful wording so that it applies when there is no expression, but the auto-increment overflows.} [109:18-20] Same subclause, p2, near the end, After "order as specified by the enum-def", insert ", and with a C integer type specifier that interoperates with the kind of integer specified by kind-selector if it appears, and without a C integer type specifier if kind-selector does not appear". That makes the sentence rather unwieldy, so the editor should split the two conditions into two bullets, making the whole sentence read: "The corresponding C enumerated type is the type that would be declared by a C enumeration specifier (ISO/IEC 9899:2024, 6.7.3.3) - that specified C enumeration constants with the same values as those specified by the enum-def, in the same order as specified by the enum-def, and - with a C integer type specifier that interoperates with the kind of integer specified by kind-selector if it appears, and without a C integer type specifier if kind-selector does not appear." {I have made the assumption here that we want to retain our requirement for corresponding values; C certainly used to require that for type compatibility, but I have not checked C23 to see if it still does.} ALTERNATIVE [109:18-20] (if we think that a kind-specifier obviates the value sequence requirement) Make the sentence look like this: "The corresponding C enumerated type is the type that would be declared by a C enumeration specifier (ISO/IEC 9899:2024, 6.7.3.3) - with a C integer type specifier that interoperates with the kind of integer specified by kind-selector if it appears, or - without a C integer type specifier if kind-selector does not appear, and that specified C enumeration constants with the same values as those specified by the enum-def, in the same order as specified by the enum-def." {We should only do this if C23 has dropped the value-sequence requirement when an integer type specifier appears in the enumerated type definition.} [109:20] Split the accessibility sentence at the end of p2 into a new paragraph. It would appear after the bullet list anyway, so might as well be a new para to avoid confusion. [110:15+14+] Between NOTE 4 "Example of an interoperable..." and NOTE 5 "There is no difference..." Insert new NOTE: "NOTE 4a Specifying a kind-selector facilitates interoperation with the new syntax for enums introduced by ISO/IEC-9899:2024. For example, for the enumerator enum my_long_enum : long { red = 4, blue = 9, yellow }; the corresponding Fortran interoperable enumeration could be defined by ENUM (KIND=C_LONG), BIND (C) :: my_long_enum ENUMERATOR :: red = 4, blue = 9 ENUMERATOR yellow END ENUM \end{note}" ==END==