[Rcpp-devel] (Very) rare segfault

Gregor Kastner gregor.kastner at wu.ac.at
Thu Aug 21 11:47:55 CEST 2014


On Thu, 21 Aug 2014 11:34:23 +0200
Romain Francois <romain at r-enthusiasts.com> wrote:

GK> Yep, sorry for the misuse of language. And I do understand going back to
GK> GetRNGstate() and PutRNGstate() is a bit old school; but I can definitely
GK> confirm that it seems to be safer than resorting do the
GK> constructor/destuctor magic.
>
> Compiler/Destructor is not magic. It is determinism. 
> 
> That's like feature #1 of C++. 

agreed: s/magic/automagic/g

> And BTW it is definitely safer than any manual handling.  

I cannot say that in the current case, as relying on the destructor does seem
to create problems (in rare cases, making it even worse!) if objects which
are to be returned are instantiated after the RNGScope object. Conditional on
the fact the I understood JJ correctly, that is.

Manual handling works perfectly.

Best,
/g


More information about the Rcpp-devel mailing list