-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide separate type for each resource category #913
Comments
One aspect of this that needs special consideration before we move forward with it - there are several constants and operations that work on the generic
With a distinct ID type per category - in order to be fully type correct and type safe - one would technically need to add a version of these functions for every category. At least 5 resource categories are likely to exist, maybe more. So that means instead of 2 constants and 4 utility operations we will potentially need 10 constants and 20 utility ops, which will only grow more. Again, if this were C++ with its better type system this would be a no brainer. But in C without compiler-aware inheritance or templates it gets pretty ugly and no easy migration path. I think this needs to be considered. |
If they're all based on the same parent typedef (a-la #896 (comment) ), I believe the compiler will behave and users could use the generic
|
Yes, a typedef is an alias - so you can interchange any typedef'ed names and it will work without error. My point is that you'll be limited to that typedef - the AppID/LibID/CountID etc types can never become unique types without breaking all the code that is consistent between all of them. So what is the objective of making them separately named typedefs, if they can never be unique types? This will start to become more relevant as I move to fix the old issue #28 -- for this it is actually helpful to have a single local ID variable that can refer to an app or a lib. Really for any API that can work on apps or libs, it is helpful to have an ID which is not type specific but still runtime safe in this regard. |
|
After doing #985 it is probably worthwhile to do some typedefs here:
|
Is your feature request related to a problem? Please describe.
Pull #896 provided a generic typedef for resource identifiers. This commit stops using
uint32
and makes a dedicated type, but the type is the same for all resource categories (apps, tasks, counters, etc).Describe the solution you'd like
Per @CDKnightNASA comment here:
#896 (comment)
It would improve things further to provide a separate/unique typedef for each resource category.
Additional context
This will be implemented as a follow-on to the original change.
Requester Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered: