-
Notifications
You must be signed in to change notification settings - Fork 132
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
truncation of struct initializers results in compiler warnings #248
Comments
Thanks for the thorough report. Brought up internally. :-) |
@szabi-luxonis I have a PR for some of these if you don't yet have the work started. It needs changes in this repo and changes in |
Please do. |
@szabi-luxonis I have a PR ready. What is your team's standard approach for contributors wrt which branch/commit on which PRs should be? |
Please target latest develop with PR. |
- partial fix luxonis#248
The codebase (including the precompiled Windows distribution headers) has initializers that are truncating their values. This results in compiler warnings. This and other such errors I've found #71 and #247 and #79 suggest the codebase has not been compiled with analyzers and warnings to surface easily found bugs.
Three incidents I found in my compile are
double
truncated tofloat
. As they are initializers, I would hope (but it is not promised across all compilers) that the executable would only store a float in the static init data. But if the compiler does not, then the size is doubled (4 -> 8 bytes) and additional bytecode is needed to convert the double -> float at runtime.Naturally, none of that is desired and the fix is easy. Put an
f
after the number literal.Setup
depthai-core-v2.11.1-win64
Repro
/W4
depthai-core-v2.11.1-win64
and simple code that cascades to headers likeRawFeatureTrackerConfig.hpp
. Most any code, even just a dai device, will do this.Result
Expected
No warnings or errors. No increase in exe size, no runtime convert double->float.
The text was updated successfully, but these errors were encountered: