Envoyé de mon iPhone
> Le 18 févr. 2015 à 17:31, JJ Allaire <jj.alla...@gmail.com> a écrit : > > We *can* call Rf_error from C++ code, but when we do it bypasses all > C++ destructors on the stack, so we don't do it so as not leak memory > and otherwise have deterministic behavior around > construction/destruction. > > You'll notice in Dirk's example that there are no C++ objects on the > stack when he calls Rf_error. This would still bypass the dror for the RNGscope object automatically added by Rcpp::export right ? > The core idea in Rcpp is to use > exceptions to get high enough in the stack that there are no more > destructors. > >> On Wed, Feb 18, 2015 at 9:08 AM, Sparapani, Rodney <rspar...@mcw.edu> wrote: >>> On Tue, 2015-02-17 at 17:53 -0700, JJ Allaire wrote: >>> One piece of immediate feedback on your initial implementation: you >>> can't call Rf_error from C++ code (as it will bypass C++ destructors >>> on the stack). Rather, you should throw Rcpp::exception. >> >> Hi JJ: >> >> Ok, this puzzles me. We can't call Rf_error from C++ code, but we can >> call it from within the exception handler, right? It would seem so >> since Dirk has written a nice gallery post that does it that way... >> http://gallery.rcpp.org/articles/intro-to-exceptions >> >> Just my $0.02, but I would stick to exceptions and avoid assert in C++. >> >> Rodney >> >> >> >> _______________________________________________ >> Rcpp-devel mailing list >> Rcpp-devel@lists.r-forge.r-project.org >> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel > _______________________________________________ > Rcpp-devel mailing list > Rcpp-devel@lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel