I'd like to store the type of an object that an ID belongs to in the ID:
enum
{
TYPE_VEHICLE = 0x0002,
TYPE_STRUCTURE = 0x0040
};
int main(int argc, char* argv[])
{
size_t vehicle_id = TYPE_VEHICLE | 0;
size_t structure_id = TYPE_STRUCTURE | 0;
size_t another_vehicle_id = TYPE_VEHICLE | 1;
size_t another_structure_id = TYPE_STRUCTURE | 1;
return 0;
}
It seems to work, but was just wondering if anyone can see any potential issues with it? For example, if I change the enum around (I am basing it off what I have seen in other libraries), I can have two different IDs of the same "type" that have the same value:
enum
{
TYPE_VEHICLE = 0x0001,
TYPE_STRUCTURE = 0x0002
};
vehicle_id and another_vehicle_id would both be 1.
Will this issue come up again now that I have changed the enum values? Are any other issues likely to arise?
Cheers.