[Rcpp-devel] can one modify array in R memory from C++ without copying it?

Steve Lianoglou mailinglist.honeypot at gmail.com
Fri Nov 4 15:59:38 CET 2011

On Fri, Nov 4, 2011 at 10:39 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
> On 4 November 2011 at 10:13, Steve Lianoglou wrote:
> | On Fri, Nov 4, 2011 at 9:36 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
> | > On 4 November 2011 at 16:56, Darren Cook wrote:
> | > If you feel really strongly about you could consider a patch that makes this
> | > non-R behaviour you suggest an option.  To most of us who use Rcpp between R
> | > and C++ it really is a feature.
> | >
> | > Don't get me wrong though: I like your input here and maybe the implicit
> | > nature of things needs to be stressed even more.
> |
> | What if Rcpp fires a warning (I guess there's a C function that you
> | can use to invoke R's `warning()`) in these scenarios?
> Hah. I invite to modify your copy and to activate a little message in each
> ctor.  You will be amazed to see how many implicit conversions happen.
> Plus this is templates for you.  It is not that we have an implicit
>     // pseudo-code ... and a satire!
>     // do this to really mess with Darren's head
>     if (typeof(X)=="int") {
>        doMeanConversionToNumeric(x)
>     }
> where we could neat insert
>        std::cout << "Steve suggested we tell you that something was converted"

Well ... I have always wanted my name "in lights," so to speak ... :-)

You could keep a global registry/map, where you keep track of the
addresses of the objects you've already fired warning about and the
time of the last warning, then ... you know ... check how long ago it
was before you fire a new warning on the address of the object that is
(re)implicitly being converted ... or something.

But when you say these are templates, I guess you have no ability to
even notice the conversion happening? (This is me being lost in the
"advanced" (really anything but beginner) C++ world).


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