[Rcpp-devel] how to get rid of the warning message: no graphics system to unregister

Dirk Eddelbuettel edd at debian.org
Tue Feb 14 14:40:19 CET 2012


On 14 February 2012 at 14:39, Darren Cook wrote:
| > Here is the test code I first used to call the R function from C++
| > program. At the end, the warning message came out.
| > 
| > double two_sample_logrank(RInside R, double* t, int* d,
| >      int sample_size){ ...
| 
| I think you've worked this out, but I thought this line should have been:
|    double two_sample_logrank(RInside &R, double* t, int* d,
|      int sample_size){ ...
| 
| Dirk/Romain: A quick look at the source [1] shows no copy constructor
| has been defined, which means a default one will be created that will do
| copy-by-value on all member variables... and that looks dangerous.
| 
| How about making copy private [2]? E.g. adding this section at the end
| of the class definition in RInside.h:
| 
|   private:
|    RInside(const RInside&){
| 	throw std::logic_error("Copy not allowed");
| 	}
|    RInside& operator= (const RInside&){
| 	throw std::logic_error("Assignment not allowed");
| 	}
| 
| (I had them throw in order to catch any copy attempt from inside the
| RInside class itself.)
| 
| If copy-by-value is safe, and/or copy is needed in certain
| circumstances, then ignore all that :-)

It's not a bad idea. I am trying to remember why I didn't do that when I
added the 'singleton-alike' hidden instance and initialize method...

Dirk

| [2]: http://www.devx.com/tips/Tip/12570

PS Don't you find devx a little icky?

-- 
"Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
dark to read." -- Groucho Marx


More information about the Rcpp-devel mailing list