If I have enums like:
enum EnumA
{
stuffA = 0
};
enum enumAA
{
stuffA = 1
};
What happens here when you refer to stuffA? I thought you would refer to them like EnumA.stuffA and EnumB.stuffA as in Java, but that doesn’t seem to be the case in C.
enumsdon’t introduce new scope.In your example, the second
enumwouldn’t compile due to thestuffAname clash.To avoid name clashes, it is a common practice to give the elements of an
enuma common prefix. Different prefixes would be used for different enums: