Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add definition of enum storage type #209

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions riscv-elf.md
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,13 @@ member. The size of any object is a multiple of its alignment.
Booleans (`bool`/`_Bool`) stored in memory or when being passed as scalar
arguments are either `0` (`false`) or `1` (`true`).

`enum` types use `int` as storage type if the value range fits into the value
range of `signed int` or into the value range of `unsigned int`. If the value
range is larger, the enum values use an 64bit integer storage type:

* `long` for an LP64 calling convention,
* `long long` for an ILP32 calling convention.
Comment on lines +446 to +451
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to actually specify the signedness of the types explicitly, not just that it uses an int's worth of space, as it affects things like C++ overloading. That is, it needs to be clearly:

  1. If it fits in an int, use int
  2. Else, if it fits in an unsigned int, use unsigned int
  3. Else, if it fits in a long (long), use long (long)
  4. Else use unsigned long (long)

(assuming that the long (long) case mirrors the int case in its choice of signedness)


A null pointer (for all types) has the value zero.

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