[Rcpp-devel] deprecated log_max warning

Yue Li gorillayue at gmail.com
Thu Apr 21 21:44:52 CEST 2016

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.

Thanks a lot in advance,


#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)

[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              

More information about the Rcpp-devel mailing list