[Rcpp-commits] r1145 - pkg/Rcpp/inst/examples/RcppInline
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon May 3 20:56:22 CEST 2010
Author: edd
Date: 2010-05-03 20:56:22 +0200 (Mon, 03 May 2010)
New Revision: 1145
Modified:
pkg/Rcpp/inst/examples/RcppInline/UncaughtExceptions.r
Log:
adapted to new exception scheme by using cppfunction instead of cfunction
Modified: pkg/Rcpp/inst/examples/RcppInline/UncaughtExceptions.r
===================================================================
--- pkg/Rcpp/inst/examples/RcppInline/UncaughtExceptions.r 2010-05-03 18:34:49 UTC (rev 1144)
+++ pkg/Rcpp/inst/examples/RcppInline/UncaughtExceptions.r 2010-05-03 18:56:22 UTC (rev 1145)
@@ -1,6 +1,6 @@
#!/usr/bin/r -t
#
-# Copyright (C) 2009 Romain Francois
+# Copyright (C) 2009 - 2010 Romain Francois and Dirk Eddelbuettel
#
# This file is part of Rcpp.
#
@@ -19,14 +19,11 @@
require(Rcpp)
require(inline)
-funx <- cfunction(signature(), '
-throw std::range_error("boom") ;
-return R_NilValue ;
-', Rcpp=TRUE, verbose=FALSE)
+funx <- cppfunction(signature(), 'throw std::range_error("boom"); return R_NilValue ; ')
tryCatch( funx(), "C++Error" = function(e){
cat( sprintf( "C++ exception of class '%s' : %s\n", class(e)[1L], e$message ) )
} )
-# or using a direct handler
+# or using a direct handler
tryCatch( funx(), "std::range_error" = function(e){
cat( sprintf( "C++ exception of class '%s' : %s\n", class(e)[1L], e$message ) )
} )
More information about the Rcpp-commits
mailing list