I find myself always appending the name of the enum, to its values, because else I often have conflicts with other enums, for example:
typedef enum
{
A_ONE,
A_TWO,
} A;
typedef enum
{
B_ONE,
B_TWO,
} B;
Is there a nicer way to do this in C?
No, there is not. C++ has namespaces, or enums existing in classes (IIRC), but C is extremely primitive in this regard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With