[Rcpp-devel] deprecated log_max warning

Dirk Eddelbuettel edd at debian.org
Thu Apr 21 21:51:50 CEST 2016


Hi Yue,

On 21 April 2016 at 15:44, Yue Li wrote:
| Dear List,
| 
| Just a super naive (dumb) question: after upgrading to RcppArmadillo_0.6.700.3.0 Rcpp_0.12.4, I receive compilation warning ''log_max' has been explicitly marked deprecated here” on every line of my code that uses ‘trunc_exp’ or ‘trunc_log’.
| 
| I wonder how to fix this. The code to reproduce the warning and the log are pasted below. I got the same warning on Linux server as well.

Many of us use Rcpp and RcppArmadillo daily but I have not seen this.  I
gather that you use OS X -- so I presume this is clang?  What version?

Do you set particular compiler flags?  I often use --pendantic.

Did you try adding -Wno-deprecated-declarations as suggested?

Did you chase down which header files this is from?

Lastly, did you poke into the Armadillo header?  From the top of my head I
seem to recall that there is a define to suppress error mesages too.

Dirk

| 
| Thanks a lot in advance,
| Yue
| 
| Code:
| 
| #include <RcppArmadillo.h>
| 
| // [[Rcpp::depends("RcppArmadillo")]]
| 
| // [[Rcpp::export]]
| double trunc_exp_Rcpp(double x) {
|   
|   return arma::trunc_exp(x);
| }
| 
| Outputs log:
| 
| > Rcpp::sourceCpp('tmp.cpp')
| In file included from tmp.cpp:1:
| In file included from /Library/Frameworks/R.framework/Versions/3.2/Resources/library/RcppArmadillo/include/RcppArmadillo.h:31:
| In file included from /Library/Frameworks/R.framework/Versions/3.2/Resources/library/RcppArmadillo/include/RcppArmadilloForward.h:46:
| In file included from /Library/Frameworks/R.framework/Versions/3.2/Resources/library/RcppArmadillo/include/armadillo:458:
| /Library/Frameworks/R.framework/Versions/3.2/Resources/library/RcppArmadillo/include/armadillo_bits/fn_trunc_exp.hpp:23:60: warning: 'log_max' is deprecated [-Wdeprecated-declarations]
|   if(std::numeric_limits<eT>::is_iec559 && (x >= Math<eT>::log_max() ))
|                                                            ^
| tmp.cpp:8:16: note: in instantiation of function template specialization 'arma::trunc_exp<double>' requested here
|   return arma::trunc_exp(x);
|                ^
| /Library/Frameworks/R.framework/Versions/3.2/Resources/library/RcppArmadillo/include/armadillo_bits/constants_old.hpp:50:29: note: 'log_max' has been explicitly marked deprecated here
|   arma_deprecated static eT log_max()   { static const eT out = std::log(std::numeric_limits<eT>::max()); return out; }  // use datum::log_max instead
|                             ^
| 1 warning generated.
| > sessionInfo()
| R version 3.2.4 (2016-03-10)
| Platform: x86_64-apple-darwin13.4.0 (64-bit)
| Running under: OS X 10.11.4 (El Capitan)
| 
| locale:
| [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
| 
| attached base packages:
| [1] stats     graphics  grDevices utils     datasets  methods   base     
| 
| loaded via a namespace (and not attached):
| [1] tools_3.2.4               RcppArmadillo_0.6.700.3.0 Rcpp_0.12.4              
| > 
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org


More information about the Rcpp-devel mailing list