Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
enum types in C/Objective-C
// unpredictable backing type for this enum
typedef enum {
CDZTypePhone,
CDZTypeEmail
} CDZType;
// vs.
enum {
CDZTypePhone,
CDZTypeEmail
};
typedef NSUInteger CDZType;
// vs. a better way via Clang's support for C++11 enumerations
// http://clang.llvm.org/docs/LanguageExtensions.html#objc_fixed_enum
typedef enum : NSUInteger {
CDZTypePhone,
CDZTypeEmail
} CDZType;
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.