Of course, if you think it is necessary. I met a very similar problem about one year ago. GSL is a pure C library, and try/catch is something in C++.
Best, KK On Thu, Dec 11, 2014 at 10:36 AM, Dirk Eddelbuettel <e...@debian.org> wrote: > > > Qiang, how about wrapping ten lines of context around > it and making it an Rcpp Gallery post? This ought to be documented.... > > Dirk > > | > | > | On Thu, Dec 11, 2014 at 10:03 AM, Devin <devin.h...@gmail.com> wrote: > | > | > | Dear list > | > | > | > | My Rcpp source file contains a gsl_sf_hyperg_2F1() function, and for > some > | input values to this function the return value is “NaN”, which leads > in > | RStudio to an abortion error. > | > | > | > | In order to avoid abortion errors, I try to implement a try/catch > exception > | handler: > | > | > | // [[Rcpp::depends(RcppGSL)]] > | > | #include <RcppGSL.h> > | > | #include <gsl/gsl_sf_hyperg.h> > | > | > | > | #include <Rcpp.h> > | > | #include <math.h> > | > | using namespace Rcpp; > | > | > | > | // [[Rcpp::export]] > | > | int test() > | > | { > | > | try{ > | > | gsl_sf_hyperg_2F1(1,1,1.1467003,1); // abortion error since > not > | defined > | > | } > | > | catch(std::domain_error& e){ > | > | std::cout << "Domain Error occurred!" << std::endl; > | > | } > | > | return 0; > | > | } > | > | > | > | This seems to be wrong, since it still causes an abortion error in > RStudio. > | > | > | > | I appreciate any input > | > | > | > | Thanks > | > | Devin > | > | > | > | > | _______________________________________________ > | 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 > | > | > | > | > | -- > | Qiang Kou > | q...@umail.iu.edu > | School of Informatics and Computing, Indiana University > | > | _______________________________________________ > | 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 > > -- > http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org > -- Qiang Kou q...@umail.iu.edu School of Informatics and Computing, Indiana University
_______________________________________________ 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