-
-
Save cdzombak/3860927 to your computer and use it in GitHub Desktop.
enum types in C/Objective-C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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