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

Prefer C++ "enum class" to "enum" #1049

Open
hjmjohnson opened this issue Jun 30, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@hjmjohnson
Copy link
Member

commented Jun 30, 2019

Description

Prefer C++ "enum class" to "enum"

https://stackoverflow.com/questions/18335861/why-is-enum-class-preferred-over-plain-enum

Impact analysis

Places where types are implicitly converted, may now need explicit static_casts.

Expected behavior

Other than being explicit with type conversions, this should provide more careful conversion and strict usage of enumerations.

Actual behavior

    typedef enum {
      MUSTFLUSH = 0,
      FATAL,
      CRITICAL,
      WARNING,
      INFO,
      DEBUG,
      NOTSET
      } PriorityLevelType;

to

 enum class PriorityLevelType {
      MUSTFLUSH = 0,
      FATAL,
      CRITICAL,
      WARNING,
      INFO,
      DEBUG,
      NOTSET
      };

Additional Information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.