[Rcpp-devel] C++ Throwing Exception.

Cedric Ginestet c.ginestet05 at googlemail.com
Wed Dec 22 12:56:47 CET 2010


Dear Rcpp experts,
>
> I have got another problem with the throw of exception in C++ 
> channelled into R. Apologies but these codes are not reproducible: I 
> didn't succeed to use the BEGIN_RCPP ... END_RCPP commands with the 
> inline-package. Help regarding this would be also welcomed.
>
> #################################################
> SEXP edge_update(SEXP D, SEXP Vpair){
> BEGIN_RCPP
>    // Translation.
>    NumericMatrix xD(D);
>    IntegerVector xVpair(Vpair);
>    xVpair = xVpair-1;
>    for(int i=0; i<xVpair.size(); i++) if(xVpair[i] < 0)*throw("Matrix 
> Index is lower than 0."); *
>    cxx_edge_update(xD,xVpair);
> return xD;
> END_RCPP
> }//edge.update
> #################################################
>
> However, when I run it in R, I only get:
>
> > edge.update(D10,c(0,2))
> Error in edge.update(D10, c(0, 2)) : c++ exception (unknown reason)
>
> How can I modify my code in order to get the reason for the exception 
> printed within R.
> Thank you very much,
>
>
> -- 
> Cedric Ginestet
> Centre for Neuroimaging Sciences (L3.04)
> NIHR Biomedical Research Centre
> Department of Neuroimaging
> Institute of Psychiatry, Box P089
> King's College London
> De Crespigny Park
> London
> SE5 8AF
> Tel: (+44) 20-3228-3052
> Fax: (+44) 20-3228-2116
> Email: cedric.ginestet at kcl.ac.uk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20101222/9d14436c/attachment.htm>


More information about the Rcpp-devel mailing list