[Rcpp-devel] Idiom for accessing scalars

Steve Lianoglou mailinglist.honeypot at gmail.com
Fri Jan 6 19:00:08 CET 2012


Hi,

2012/1/6 Douglas Bates <bates at stat.wisc.edu>:
[snip]
> As I mentioned in another thread, I prefer the idiom
>
> int n2 = ::Rf_asInteger(n);
>
> because asInteger is part of the R API (in Rcpp it must be called as
> Rf_asInteger - the :: is a hint to the compiler that it will be found
> in the global namespace).  Functions like asInteger and asReal are
> used in thousands of places in the base R code and have been optimized
> to death as well as being as general as they can possibly be.

Cool ... I actually missed that tip, thanks for pointing it out again.

Cheers,
-steve

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact


More information about the Rcpp-devel mailing list