To do it, you have to modify the original type definition to include the new value:
typedef enum {
UIModalTransitionStyleCoverVertical = 0,
UIModalTransitionStyleFlipHorizontal,
UIModalTransitionStyleCrossDissolve,
UIModalTransitionStylePartialCurl,
UIModalTransitionStyleCoverVerticalFlipped
} UIModalTransitionStyle;
Otherwise, you can take a chance on its not working, and define it separately:
typedef enum {
UIModalTransitionStyleCoverVertical = 0,
UIModalTransitionStyleFlipHorizontal,
UIModalTransitionStyleCrossDissolve,
UIModalTransitionStylePartialCurl,
} UIModalTransitionStyle;
typedef enum {
UIModalTransitionStyleCoverVerticalFlipped =
UIModalTransitionStylePartialCurl + 1
} ExtendedUIModalTransitionStyle;
A variable that could hold the original enumeration will usually also work perfectly fine when/if you assign the new value as well (in a typical case, it'll just be an int
) -- but it's not guaranteed. At least in theory, the implementation can/could assign few enough bits to hold that enumeration that it adding more values this way wouldn't work. It could also do range checking so assigning any out of range value wouldn't be allowed. Neither of these is at all common, so from a practical viewpoint it's probably not a problem -- but from a theoretical viewpoint, nothing really guarantees that code like this will work.