[Rcpp-devel] experimental handling of uncaught exceptions

Dirk Eddelbuettel edd at debian.org
Sun Dec 27 20:36:49 CET 2009


On 27 December 2009 at 18:15, Romain François wrote:
| Hi,
| 
| I've commited some code that aims at forwarding uncaught C++ exceptions 
| to R.
| 
| For example :
| 
| require( Rcpp)
| funx <- cfunction(signature(), '
| throw std::range_error("boom") ;
| return R_NilValue ;
| ', Rcpp=TRUE, verbose=FALSE)
| tryCatch(  funx(), "C++Error" = function(e){
| 	print( "gotcha" )
| } )
| print( rnorm(10) )

That's pretty crazy cool -- I'll have to try that.

| This is experimental so it will need to be reviewed.
| 
| This is based on this page : 
| http://www.linuxtopia.org/online_books/programming_books/c%2B%2B_practical_programming/c++_practical_programming_023.html

Neat.

Dirk

-- 
Three out of two people have difficulties with fractions.


More information about the Rcpp-devel mailing list