I saw this c++ code snippet in a program:
enum
{
ID_IsNotPickable = 0,
IDFlag_IsPickable = 1 << 0,
IDFlag_IsHighlightable = 1 << 1
};
Why wouldn't they just do:
enum
{
ID_IsNotPickable,
IDFlag_IsPickable,
IDFlag_IsHighlightable
};
Both would assign the same values:
ID_IsNotPickable = 0
IDFlag_IsPickable = 1
IDFlag_IsHighlightable = 2
Any ideas why they would use this method? The coder is the guy that wrote the irrlicht engine and he knows his stuff, so there must be a neat reason why he would do this.