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

support @repr u8 on enums in C backend #30

Open
Gankra opened this issue Jun 30, 2024 · 0 comments
Open

support @repr u8 on enums in C backend #30

Gankra opened this issue Jun 30, 2024 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Gankra
Copy link
Owner

Gankra commented Jun 30, 2024

In rust #[repr(u8)] says a C-like enum's underlying type should be a u8. #[repr(C)] says it should have underlying type int (or whatever matches the dominant C ABI of the target platform).

In C++ this attribute could be lowered to an enum class with the following syntax:

enum class MyEnum: uint8_t { ... }

In C I'm not sure what the equivalent is -- possibly in the most extreme generating #defines. Although i vaguely recall hearing newer C's getting an equivalent of the C++ syntax here?

@Gankra Gankra added enhancement New feature or request help wanted Extra attention is needed labels Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant