Skip to content

Commit 145f5ba

Browse files
authored
Merge pull request #3067 from WalterBright/ImportCEnum
ImportC: add section on enums
2 parents 97f25fa + bbd48ff commit 145f5ba

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

spec/importc.dd

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,26 @@ $(H2 $(LNAME2 preprocessor-directives, Preprocessor Directives))
122122
directives are normally embedded in the output of C preprocessors.)
123123

124124

125+
$(H2 $(LNAME2 implementation, Implementation))
126+
127+
$(P The implementation defined characteristics of ImportC are:)
128+
129+
$(H3 $(LNAME2 enums, Enums))
130+
131+
$(P $(I enumeration-constants) are always typed as `int`.)
132+
133+
$(P The expression that defines the value of an $(I enumeration-constant) must
134+
be an integral type and evaluate to an integer value that fits in an `int`.)
135+
136+
---
137+
enum E { -10, 0x81231234 }; // ok
138+
enum F { 0x812312345678 }; // error, doesn't fit in int
139+
enum G { 1.0 }; // error, not integral type
140+
---
141+
142+
$(P The enumerated type is `int`.)
143+
144+
125145
$(H2 $(LNAME2 limitations, Limitations))
126146

127147
$(H3 $(LNAME2 exceptions, Exception Handling))

0 commit comments

Comments
 (0)