4 ms·
Don't use a raw integer as the ID type. Use different types for different IDs: UserId, OrganizationId, etc. It's a common bug to get different ID types mixed u
by continuational 6y ago
Don't use a raw integer as the ID type. Use different types for different IDs: UserId, OrganizationId, etc.
It's a common bug to get different ID types mixed up, and a gigantic offset will do nothing to help you with that.
- MaxBarraclough 6y agoI agree, the 'microtype' pattern can be a good way of getting the type-checker to catch silly mistakes. In Ada it's standard practice. In C++ you really need a library to do it easily, but there's a good one out there ready to go: https://github.com/foonathan/type_safe/ https://github.com/foonathan/type_safe/