[Rcpp-devel] Trouble passing arguments to R functions that have been passed in (maybe)

Anthony Lee awllee at gmail.com
Mon Sep 10 23:42:15 CEST 2012


On 10/09/12 22:05, Dirk Eddelbuettel wrote:
>
> I didn't have a lot of time for your post but I suspect your design is broken
> if you plan to call an R function in each itereation of a C++ loop.
>
> Just because you can does not mean you should.
>
> Dirk
>

In fact, there are some good reasons for doing so, amongst them being 
the ability to play around with exactly those functions while leaving 
the rest of the code untouched. Naturally, calling C++ functions 
directly would be faster, and I was planning on trying to allow for 
Rcpp::XPtr's to be passed in for special cases, but speed is not the 
overriding design principle here, not least because I have other 
projects that focus exclusively on speed. It is also the case that a 
significant amount of compute will be done in those functions in general 
(whether they are implemented in C++ or not), so the overhead is not an 
issue.

In any case, if I have made a mistake and it is possible to ensure the 
safety of the R function call, then I would be glad to hear how I can 
correct it.

Anthony



More information about the Rcpp-devel mailing list