-
Notifications
You must be signed in to change notification settings - Fork 8
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
[Bug]: Resolve C++ compile warnings #351
Comments
The -w flag removes all warnings on Unix and I believe Linux platforms. Not sure what flag is required for MakeVars.win. |
@ChristineStawitz-NOAA and @msupernaw, should we be editing the Makevars.win file to ignore the warnings or fixing them? I think most are coming from a comparison between types size_t and int, e.g.: We could either declare j as size_t or cast nages to int inside the for loop expression to fix all the warnings. |
Are the only warnings Thanks! |
There are two other warnings:
|
@Andrea Havron - NOAA Federal ***@***.***> We should fix
warnings about mismatched types and other minor things in our code. After
that, we can silence warnings for Eigen using the -w flag for
g++/clang++/MinGW.
…On Wed, Aug 2, 2023 at 11:49 AM Andrea-Havron-NOAA ***@***.***> wrote:
There are two other warnings:
- rcpp_population: for (size_t i = 0; i < log_init_naa.size(); i++):
warning: comparison of integer expressions of different signedness:
'size_t{aka 'long long unsigned int and 'R_xlen_t{aka 'long long
int-Wsign-compare
- data_object: size_t jmax;: warning: fims::DataObject::jmaxl be
initialized after [-Wreorder
—
Reply to this email directly, view it on GitHub
<#351 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABFUSECOOCTZGFJTN7Z3S3TXTJZHXANCNFSM6AAAAAAXEMGEMU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Matthew Supernaw
*Scientific Software Developer*
*National Oceanic and Atmospheric Administration*
*Office Of Science and Technology*
*NOAA Fisheries | *U.S. Department of Commerce
Phone 248 - 396 - 7797
|
I think the data_object warning is when you change the orders of when |
You need to change the dimension member as the first thing initialized in DataObject. |
Thanks! For the rcpp_population warning, should we cast log_init_naa.size() as size_t? log_init_naa is declared as an Rcpp::NumericVector |
@Andrea-Havron-NOAA Yes, I think so. The Rcpp documentation says log_init_naa.size() returns a R_xlen_t type, which is typdefed here as either a ptrdiff_t or an int depending on the preprocessing macro. Both are signed integers. |
I found this issue on it in Rcpp..RcppCore/Rcpp#811 It looks like |
@ChristineStawitz-NOAA According to Rinternals.h, R_xlen_t is definitely signed. It's typedef'd as a ptrdiff_t or int and both are signed. If the documentation is not correct, the best way to tell is to print typeid(x).name() to standard out. If "m" is returned, it's a size_t, if "i" is returned, it's an integer. |
Hmm, a quick test on my computer says it's a long! Rcpp::NumericVector nv; Output: |
sorry typo above, I meant to say it is signed, not that it isn't signed. |
Describe the bug
We should get rid of the warnings and notes that happen at compilation in MQ
To Reproduce
devtools::load_all()
Expected behavior
Expect no warnings
Screenshots
No response
Which OS are you seeing the problem on?
No response
Which browser are you seeing the problem on?
No response
Which version of FIMS are you seeing the problem on?
No response
Additional Context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: