In your code, ValidationStatusCodes means int , not your anonymous enum type. Therefore, they are practically not connected.
However, since your enum contains int values, you can say that there is some relation. You can pass the names of enumerated values, and they will be considered of type int or ValidationStatusCodes .
By the way, Apple does something similar to what you do, except that they typedef their collective names up to NSInteger or NSUInteger instead of int or uint . See this question for an example.
With all of this, a more common practice is typedef your custom type name directly to anonymous enum , for example:
typedef enum { ValidationLoginFailed = 2000, ValidationSessionTokenExpired = 2001, ValidationSessionTokenInvalid = 2002, ValidationEmailNotFound = 2003 ValidationSuccessMIN = ValidationLoginFailed, ValidationSuccessMAX = ValidationEmailNotFound, ValdationValidSuccessCode = 9999, ValdationInvalidCode = 10000 } ValidationStatusCodes;
source share