metrumresearchgroup / mrgsolve

Simulate from ODE-based population PK/PD and QSP models in R
https://mrgsolve.org
129 stars 36 forks source link

Fix compiler warning - comparison of signed and unsigned integers #1218

Closed kylebaron closed 1 month ago

kylebaron commented 1 month ago

Fixing a type (int to size_t) warning based on winbuilder output (#1217). This is a harmless compiler warning, but going to fix this now to get it as clean as possible.

start gets passed in from j, which is size_t because we're always comparing to object.size(). This PR just makes it consistent and should avoid the compiler warning for comparing signed and unsigned integers.

kylebaron commented 1 month ago

No longer getting this compiler warning:

* installing *source* package 'mrgsolve' ...
** package 'mrgsolve' successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C++ compiler: 'g++.exe (GCC) 13.2.0'
g++ -std=gnu++17  -I"D:/RCompile/recent/R/include" -DNDEBUG -I../inst/include -I../inst/base -g -I. -I'D:/RCompile/CRANpkg/lib/4.5/Rcpp/include' -I'D:/RCompile/CRANpkg/lib/4.5/RcppArmadillo/include' -I'D:/RCompile/CRANpkg/lib/4.5/BH/include'   -I"d:/rtools44/x86_64-w64-mingw32.static.posix/include"     -pedantic -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c LSODA.cpp -o LSODA.o
g++ -std=gnu++17  -I"D:/RCompile/recent/R/include" -DNDEBUG -I../inst/include -I../inst/base -g -I. -I'D:/RCompile/CRANpkg/lib/4.5/Rcpp/include' -I'D:/RCompile/CRANpkg/lib/4.5/RcppArmadillo/include' -I'D:/RCompile/CRANpkg/lib/4.5/BH/include'   -I"d:/rtools44/x86_64-w64-mingw32.static.posix/include"     -pedantic -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++17  -I"D:/RCompile/recent/R/include" -DNDEBUG -I../inst/include -I../inst/base -g -I. -I'D:/RCompile/CRANpkg/lib/4.5/Rcpp/include' -I'D:/RCompile/CRANpkg/lib/4.5/RcppArmadillo/include' -I'D:/RCompile/CRANpkg/lib/4.5/BH/include'   -I"d:/rtools44/x86_64-w64-mingw32.static.posix/include"     -pedantic -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c dataobject.cpp -o dataobject.o
g++ -std=gnu++17  -I"D:/RCompile/recent/R/include" -DNDEBUG -I../inst/include -I../inst/base -g -I. -I'D:/RCompile/CRANpkg/lib/4.5/Rcpp/include' -I'D:/RCompile/CRANpkg/lib/4.5/RcppArmadillo/include' -I'D:/RCompile/CRANpkg/lib/4.5/BH/include'   -I"d:/rtools44/x86_64-w64-mingw32.static.posix/include"     -pedantic -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c datarecord.cpp -o datarecord.o
g++ -std=gnu++17  -I"D:/RCompile/recent/R/include" -DNDEBUG -I../inst/include -I../inst/base -g -I. -I'D:/RCompile/CRANpkg/lib/4.5/Rcpp/include' -I'D:/RCompile/CRANpkg/lib/4.5/RcppArmadillo/include' -I'D:/RCompile/CRANpkg/lib/4.5/BH/include'   -I"d:/rtools44/x86_64-w64-mingw32.static.posix/include"     -pedantic -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c devtran.cpp -o devtran.o
g++ -std=gnu++17  -I"D:/RCompile/recent/R/include" -DNDEBUG -I../inst/include -I../inst/base -g -I. -I'D:/RCompile/CRANpkg/lib/4.5/Rcpp/include' -I'D:/RCompile/CRANpkg/lib/4.5/RcppArmadillo/include' -I'D:/RCompile/CRANpkg/lib/4.5/BH/include'   -I"d:/rtools44/x86_64-w64-mingw32.static.posix/include"     -pedantic -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c housemodel-mread-source.cpp -o housemodel-mread-source.o
g++ -std=gnu++17  -I"D:/RCompile/recent/R/include" -DNDEBUG -I../inst/include -I../inst/base -g -I. -I'D:/RCompile/CRANpkg/lib/4.5/Rcpp/include' -I'D:/RCompile/CRANpkg/lib/4.5/RcppArmadillo/include' -I'D:/RCompile/CRANpkg/lib/4.5/BH/include'   -I"d:/rtools44/x86_64-w64-mingw32.static.posix/include"     -pedantic -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c mrgsolve.cpp -o mrgsolve.o
In file included from D:/RCompile/CRANpkg/lib/4.5/BH/include/boost/mpl/aux_/na_assert.hpp:23,
                 from D:/RCompile/CRANpkg/lib/4.5/BH/include/boost/mpl/arg.hpp:25,
                 from D:/RCompile/CRANpkg/lib/4.5/BH/include/boost/mpl/placeholders.hpp:24,
                 from D:/RCompile/CRANpkg/lib/4.5/BH/include/boost/iterator/iterator_categories.hpp:16,
                 from D:/RCompile/CRANpkg/lib/4.5/BH/include/boost/iterator/iterator_adaptor.hpp:14,
                 from D:/RCompile/CRANpkg/lib/4.5/BH/include/boost/token_iterator.hpp:22,
                 from D:/RCompile/CRANpkg/lib/4.5/BH/include/boost/tokenizer.hpp:20,
                 from mrgsolve.cpp:29:
D:/RCompile/CRANpkg/lib/4.5/BH/include/boost/mpl/assert.hpp:194:21: warning: unnecessary parentheses in declaration of 'assert_arg' [-Wparentheses]
  194 | failed ************ (Pred::************
      |                     ^~~~~~~~~~~~~~~~~~~
  195 |       assert_arg( void (*)(Pred), typename assert_arg_pred<Pred>::type )
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  196 |     );

Compare with

* installing *source* package 'mrgsolve' ...
** package 'mrgsolve' successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C++ compiler: 'g++.exe (GCC) 13.2.0'
g++ -std=gnu++17  -I"D:/RCompile/recent/R/include" -DNDEBUG -I../inst/include -I../inst/base -g -I. -I'D:/RCompile/CRANpkg/lib/4.5/Rcpp/include' -I'D:/RCompile/CRANpkg/lib/4.5/RcppArmadillo/include' -I'D:/RCompile/CRANpkg/lib/4.5/BH/include'   -I"d:/rtools44/x86_64-w64-mingw32.static.posix/include"     -pedantic -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c LSODA.cpp -o LSODA.o
g++ -std=gnu++17  -I"D:/RCompile/recent/R/include" -DNDEBUG -I../inst/include -I../inst/base -g -I. -I'D:/RCompile/CRANpkg/lib/4.5/Rcpp/include' -I'D:/RCompile/CRANpkg/lib/4.5/RcppArmadillo/include' -I'D:/RCompile/CRANpkg/lib/4.5/BH/include'   -I"d:/rtools44/x86_64-w64-mingw32.static.posix/include"     -pedantic -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++17  -I"D:/RCompile/recent/R/include" -DNDEBUG -I../inst/include -I../inst/base -g -I. -I'D:/RCompile/CRANpkg/lib/4.5/Rcpp/include' -I'D:/RCompile/CRANpkg/lib/4.5/RcppArmadillo/include' -I'D:/RCompile/CRANpkg/lib/4.5/BH/include'   -I"d:/rtools44/x86_64-w64-mingw32.static.posix/include"     -pedantic -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c dataobject.cpp -o dataobject.o
g++ -std=gnu++17  -I"D:/RCompile/recent/R/include" -DNDEBUG -I../inst/include -I../inst/base -g -I. -I'D:/RCompile/CRANpkg/lib/4.5/Rcpp/include' -I'D:/RCompile/CRANpkg/lib/4.5/RcppArmadillo/include' -I'D:/RCompile/CRANpkg/lib/4.5/BH/include'   -I"d:/rtools44/x86_64-w64-mingw32.static.posix/include"     -pedantic -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c datarecord.cpp -o datarecord.o
datarecord.cpp: In function 'void insert_record(reclist&, int, rec_ptr&, bool)':
datarecord.cpp:600:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::deque<std::shared_ptr<datarecord> >::size_type' {aka 'long long unsigned int'} [-Wsign-compare]
  600 |     for(i = start + 1; i < thisi.size(); ++i) {
      |                        ~~^~~~~~~~~~~~~~
datarecord.cpp:606:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::deque<std::shared_ptr<datarecord> >::size_type' {aka 'long long unsigned int'} [-Wsign-compare]
  606 |     for(i = start + 1; i < thisi.size(); ++i) {
      |                        ~~^~~~~~~~~~~~~~
g++ -std=gnu++17  -I"D:/RCompile/recent/R/include" -DNDEBUG -I../inst/include -I../inst/base -g -I. -I'D:/RCompile/CRANpkg/lib/4.5/Rcpp/include' -I'D:/RCompile/CRANpkg/lib/4.5/RcppArmadillo/include' -I'D:/RCompile/CRANpkg/lib/4.5/BH/include'   -I"d:/rtools44/x86_64-w64-mingw32.static.posix/include"     -pedantic -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c devtran.cpp -o devtran.o
g++ -std=gnu++17  -I"D:/RCompile/recent/R/include" -DNDEBUG -I../inst/include -I../inst/base -g -I. -I'D:/RCompile/CRANpkg/lib/4.5/Rcpp/include' -I'D:/RCompile/CRANpkg/lib/4.5/RcppArmadillo/include' -I'D:/RCompile/CRANpkg/lib/4.5/BH/include'   -I"d:/rtools44/x86_64-w64-mingw32.static.posix/include"     -pedantic -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c housemodel-mread-source.cpp -o housemodel-mread-source.o
g++ -std=gnu++17  -I"D:/RCompile/recent/R/include" -DNDEBUG -I../inst/include -I../inst/base -g -I. -I'D:/RCompile/CRANpkg/lib/4.5/Rcpp/include' -I'D:/RCompile/CRANpkg/lib/4.5/RcppArmadillo/include' -I'D:/RCompile/CRANpkg/lib/4.5/BH/include'   -I"d:/rtools44/x86_64-w64-mingw32.static.posix/include"     -pedantic -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c mrgsolve.cpp -o mrgsolve.o
In file included from D:/RCompile/CRANpkg/lib/4.5/BH/include/boost/mpl/aux_/na_assert.hpp:23,
                 from D:/RCompile/CRANpkg/lib/4.5/BH/include/boost/mpl/arg.hpp:25,
                 from D:/RCompile/CRANpkg/lib/4.5/BH/include/boost/mpl/placeholders.hpp:24,
                 from D:/RCompile/CRANpkg/lib/4.5/BH/include/boost/iterator/iterator_categories.hpp:16,
                 from D:/RCompile/CRANpkg/lib/4.5/BH/include/boost/iterator/iterator_adaptor.hpp:14,
                 from D:/RCompile/CRANpkg/lib/4.5/BH/include/boost/token_iterator.hpp:22,
                 from D:/RCompile/CRANpkg/lib/4.5/BH/include/boost/tokenizer.hpp:20,
                 from mrgsolve.cpp:29:
D:/RCompile/CRANpkg/lib/4.5/BH/include/boost/mpl/assert.hpp:194:21: warning: unnecessary parentheses in declaration of 'assert_arg' [-Wparentheses]
  194 | failed ************ (Pred::************