Skip to content
Prev 7749 / 10988 Next

[Rcpp-devel] Raise a condition

Tim,

Step back for a second and recognise that everything happens via

   SEXP .Call(SEXP a, SEXP b, ...)

where R calls your C++ routine asynchronously.  

You can do tricks _within the subroutine that is called_ which is essentially
what happens via the automatically-added try/catch block we have in C++.  And
Rcpp::stop() is just a shortcut for using those.

Beyond .Call() you just have what "Writing R Extension" describes in Section
6.2 "Error handling", the forementioned error() and warning() [ which we
prefix with Rf_ as not-namespace-protected error() clashes too easily with
macros or functions in other libraries ]

Any other really low-hanging fruits would probably have been picked by other
Rcpp users.

Dirk