nasa / bplib

Apache License 2.0
27 stars 13 forks source link

Use safer type for handle/descriptor IDs #64

Closed jphickey closed 2 years ago

jphickey commented 2 years ago

BPLib often uses a simple int to identify different objects/records/services, things like OS-provided files and mutexes, BPLIB storage services, and all the various other items. There are two big weaknesses here:

Recommendation: Use an abstract, type-safe value as ID, where a value that has been zero-ed out does not alias a real/valid value, and also makes sure that IDs of different types do not alias each other.