I came across an enum definition :-typedef enum NSInteger {    kBorderTypeNone   = 0,    kBorderTypeLeft   = 1 << 0,    kBorderTypeRight  = 1 << 1,    kBorderTypeTop    = 1 << 2,    kBorderTypeBottom = 1 << 3} BorderType;and also (possibly) it can be equivalent totypedef enum NSInteger {    kBorderTypeNone   = 0,    kBorderTypeLeft   = 1 ,    kBorderTypeRight  = 2,    kBorderTypeTop    = 4,    kBorderTypeBottom = 8} BorderType;What are the internal differences(if any)? Is there any advantage of one over the other? Which one is recommended?If both are same then how compiler handles it? In which phase of compiler is it reduced to same set of instructions?
Difference between the two enums
ios;objective c
These are both identical and different purely in programmer's style.  If you are looking at compiled code, it'll be byte-by-byte the same.Not sure how much compiler theory you are looking to get into, but at a very simple level compilers generally have two phases: tokenize the file and builds a parse treeconvert parse tree into lower level instructions The simplification could theorically occur at either one of the stages.  When parse tree is assembled, if objects are detected to be [const] [op] [const], at that point the compiler has enough information to simply create one constant that represents the result of the operation.  Or I guess it could blindly put the operation as part of the parse tree and let second step do simplification.I've had the pleasure of writing a simple compiler as part of a Computer Science degree (that was a long time ago, but I'd like to think I remember something from college) and in my case, I found it simpler to do simplification on the spot (i.e. first step) and put the resulting constant as part of the parse tree.  That way various places could deal with this constant uniformly (i.e. if-statement vs. switch statements vs. while loops).  By the time you have to act on what each language construct has to do, all those various places wouldn't have to worry about performing the 1 << 3 calculation because by that point it would already be a simple integer.