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

Issue 3483 - Eliminate read-modify-write operations for enums #177

Closed
wants to merge 1 commit into from

Conversation

yebblies
Copy link
Member

Disable rmw operations for enums (+=, -=, *=, ++, --, etc)

http://d.puremagic.com/issues/show_bug.cgi?id=3483

The corresponding phobos pull request is: (already merged)
dlang/phobos#127

Disable rmw operations for enums (+=, -=, *=, ++, --, etc)
@braddr
Copy link
Member

braddr commented Jun 30, 2011

I don't know that I like eliminating the bitwise operators. Enums are so often used as named bitflags. As perfect example, part of what you had to fix in phobos. The rest, I can see eliminating.

@yebblies
Copy link
Member Author

I'm not 100% on this either. It can be useful, but it also easily creates a value that is not a member of the enum, and that is arguably wrong. This is part of the reason behind previous proposals of a separate bitflags enum type.
It might be worth voicing your concerns on the bugzilla page as well.

braddr pushed a commit to braddr/dmd that referenced this pull request Sep 15, 2011
avoid collision of store name with accessors in single member bitfield
@WalterBright
Copy link
Member

I'm going to reject this one. I'm not convinced it is a significant source of bugs, there are many legitimate uses of op= for enums, and the rather loose definition of them is traditional for C.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants