-
-
Notifications
You must be signed in to change notification settings - Fork 220
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
Inline enum values #1819
Comments
Do we want this? |
If this is used for C enums, then this would not mean you can do: enum Foo : { inline int val }
{
ABC = 4;
}
extern void useFoo(Foo f);
...
useFoo(ABC); Instead you'd have to do enum Foo : { inline int val }
{
ABC = 4;
}
extern void useFoo(int val);
...
useFoo(Foo.ABC); So all it saves is the |
I love inlined associated values but, as far as I remember, there are some cons of it |
Most of those issues are removed when going to |
Does this mean that enums in C3 are allowed to have gaps, and starting from different order? Duplicate values for different enum items? If it could improve C compatibility, I think it could be beneficial. |
By design, having gaps in enums wouldn't be possible in C3 as they are like bound to associated values. |
No but you could treat them a bit as if they were values with gaps by inlining an associated value. |
Possible feature:
The text was updated successfully, but these errors were encountered: