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

Change enums to lowercase #54

Closed
p-ranav opened this issue Feb 12, 2020 · 1 comment · Fixed by #87
Closed

Change enums to lowercase #54

p-ranav opened this issue Feb 12, 2020 · 1 comment · Fixed by #87

Comments

@p-ranav
Copy link

p-ranav commented Feb 12, 2020

per the isocpp/CppCoreGuidelines.

Enum.5: Don't use ALL_CAPS for enumerators

Reason

Avoid clashes with macros.

Example, bad

 // webcolors.h (third party header)
#define RED   0xFF0000
#define GREEN 0x00FF00
#define BLUE  0x0000FF

// productinfo.h
// The following define product subtypes based on color

enum class Product_info { RED, PURPLE, BLUE };   // syntax error

Enforcement

Flag ALL_CAPS enumerators.

I can imagine READ_ONLY and WRITE being macros in the embedded world.

@ctabin
Copy link
Owner

ctabin commented Mar 30, 2020

Hi @p-ranav,

Seems legit, I did it like this because I come from the Java world 😅
Refactoring this will cause some breaking changes 😨, so it will require a new major version and unfortunately I just released v3.0 the other day, but I'll consider it for the next update.

Thanks for the report 👍 If you don't mind submitting a PR, you're welcome.

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 a pull request may close this issue.

2 participants