[Rcpp-devel] assert() for Rcpp?

Sparapani, Rodney rsparapa at mcw.edu
Wed Feb 18 17:08:07 CET 2015


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





More information about the Rcpp-devel mailing list