-
Notifications
You must be signed in to change notification settings - Fork 424
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
[cc65] cc65 extension on enumerator constants conflicted with C23 #2429
Comments
I'm not 100% sure what this means (or what the difference between the cc65 extension and C23 would be) - however IF the fix means standard compliance (and "long" by default) then i think the cc65 mode should still used "unsigned ints" by default (longs are almost never what you really want on 6502 platforms). But i might misunderstand.... :)
That sounds useful to me (ie there could be many applications for enums being chars instead of ints) |
C23 requires the same signedness of an enumerator that is incremented from a previous one, whilst cc65 tries to use a type as small in size as possible. In a 16-bit int env, the "integer rank promotion" for enumerators are:
The "integer rank promotion" goes on until the end of the enumerator list, where the finial decision on the enumerator type is made. That is to say, the type of each enumerator constant during processing the enumerator list may be different from that when the whole list is finished. And that is the reason why the value of |
Ah, now i understand. I see the desire to make it like C23 dictates. I also see how what cc65 currently does is useful in a 6510 context too.... I guess what i would prefer is, keep the way cc65 does it now when standard=cc65, and change it to C23 when it is not. Obviously i have no idea how much of a problem this would be in practise though :) |
Points:
=
definition is limited:Should the current behavior of cc65 be "fixed" or kept as-is?
BTW, this shows how annoying the "good old enumerations" are, even with (or thanks to) compiler extensions. Any interests in enumerations with fixed underlying types from C23?
The text was updated successfully, but these errors were encountered: