Are more censuses not yet listed?

I did not find any formulations in the C ++ 11 standard, which says that unscoped enums are deprecated, but from a pragmatic point of view, I wonder if they are still useful. Many people in my team are used to converting irregular transfers in the transfer area, but this caused some headache:

class foo
{
public:
    enum MyEnum { One, Two, Three };
};

They convert this value to:

class foo
{
public:
    enum class MyEnum { One, Two, Three };
};

This means that when using these counters instead, foo::Oneit looks like foo::MyEnum::One. I requested the following best practices:

  • If you convert to an enum scope, move it from the classes to the global scope or namespace (to improve usability and avoid the last use case above).
  • enum unscoped, , namespace/class/function/etc, .

, # 1 , .

, , . ?

+4
1

. , .

, , , API , . API ( ), uint32_t - .

operator| .., " " , enum class uint32_t.

enum #define FOO 32. , , . , , int, , #define enum , !

.

, , , , . - .


, , , , . : , .

, , , enum - , .

+5

All Articles