Skip to content

Commit 575da9e

Browse files
Emmankokodlang-bot
authored andcommitted
correct importC docs on enum
1 parent f67142d commit 575da9e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

spec/importc.dd

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -372,20 +372,21 @@ $(H2 $(LNAME2 implementation, Implementation))
372372

373373
$(H3 $(LNAME2 enums, Enums))
374374

375-
$(P $(I enumeration-constants) are always typed as `int`.)
375+
$(P $(I enumeration-constants) are always typed as integers.)
376376

377377
$(P The expression that defines the value of an $(I enumeration-constant) must
378-
be an integral type and evaluate to an integer value that fits in an `int`.)
378+
be an integer. if an underlying `int` is specified in the enumeration,
379+
the defining expression must evaluate to a value that fits in an `int`.
380+
if no underlying `int` is specfied, the compiler chooses a large enough
381+
integer type to accomodate the size of the expression.)
379382

380383
---
381384
enum E { a = -10, b = 0x81231234 }; // ok
382-
enum F { c = 0x812312345678 }; // error, doesn't fit in int
385+
enum F { c = 0x812312345678 }; // ok, c expands to 8 byte to accomodate expression
386+
enum G : int { c = 0x80000000 }; // error, doesn't fit in int
383387
enum G { d = 1.0 }; // error, not integral type
384388
---
385389

386-
$(P The enumerated type is `int`.)
387-
388-
389390
$(H3 $(LNAME2 bitfields, Bit Fields))
390391

391392
$(P There are many implementation defined aspects of C11 bit fields.

0 commit comments

Comments
 (0)