Skip to content

Commit 41d4f61

Browse files
committed
Add definition of enum storage type
Some APIs use enum types in their definitions. The C specification does not define the size of the integer type used for storing and passing enum type variables. Provide a definition matching GCC's default behavior. Signed-off-by: Heinrich Schuchardt <[email protected]>
1 parent eb678d0 commit 41d4f61

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

riscv-elf.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,13 @@ member. The size of any object is a multiple of its alignment.
443443
Booleans (`bool`/`_Bool`) stored in memory or when being passed as scalar
444444
arguments are either `0` (`false`) or `1` (`true`).
445445

446+
`enum` types use `int` as storage type if the value range fits into the value
447+
range of `signed int` or into the value range of `unsigned int`. If the value
448+
range is larger, the enum values use an 64bit integer storage type:
449+
450+
* `long` for an LP64 calling convention,
451+
* `long long` for an ILP32 calling convention.
452+
446453
A null pointer (for all types) has the value zero.
447454

448455
`_Float16` is as defined in the C ISO/IEC TS 18661-3 extension.

0 commit comments

Comments
 (0)