-
Notifications
You must be signed in to change notification settings - Fork 208
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
Add compile time assert that int size is 32 bit #534
Comments
There really shouldn't be an issue running on a system where Many My preference is to still avoid asserting on items that aren't known to be problems. In this case it is just that we haven't really tested it, not that it doesn't work. |
You describe a known problem with truncation due to casting and then claim there isn't a known problem. I don't follow this logic. There is a known problem, lets add an assert. |
Because the better solution is to use I don't like compile time asserts, and especially so when they aren't really a fundamental problem. |
I agree there are better solutions, but at such a low priority I don't see it getting resolved soon. It seems prudent to notify a user of the current issue on such a system. Maybe @acudmore or @jwilmot could weigh in. I'd prefer a check along with a response that systems with int of size < 32 bits could encounter truncation due to type casting of 32 bit types to int. I'd rather be obvious about the current issue than not-so-obvious issues if used on this sort of system. A user could always remove the assert if they so chose. Lacking the obvious assert, users could head down a rat hole or run in to not-so-obvious bugs. I'm not following why this should be the preferred approach. |
Yes I agree its low priority, but I'd rather not forcibly break the build on someone just because we haven't explicitly tested the software using their configuration, especially when there is a real fix for the known issue. The truncation issue is a minor one as it only affects printfs, and only if the value actually exceeds Compile-time asserts should be reserved for items which are known to be truly incompatible with the architecture. We cannot assert against every system/config variation we haven't tested or for which there might be a potential issue or an open bug. This seems like more appropriate for release notes and documentation, not a compile-time assert. |
Is your feature request related to a problem? Please describe.
Per discussion 2/26/2020 there's likely breakage in multiple places on a system where int != 32 bit (standard minimum is 16 bit)
Describe the solution you'd like
Along with #204, cFE not really designed to work on a system without char of 8 bit size and int of 32. Enforce/warn on build.
Describe alternatives you've considered
Improve documentation? Still nice to bail on compile for those who don't read documentation.
Additional context
#504, and many other places convert int32 to int or the unsigned equiv.
Requester Info
Jacob Hageman - NASA/GSFC
The text was updated successfully, but these errors were encountered: