Usually, when I create an enumeration, each of them gets an increment of one, see
enum
{
A = 0,
B,
C,
D
};
but after I looked through some source codes, I see that people do things like this.
enum
{
A = 0,
B = 1 << 0,
C = 1 << 1,
D = 1 << 2
};
I understand what this means, but what exactly does this give me? Are there any advantages? I only see that this, in my opinion, looks awkward.
source
share