Skip to content

Commit 7dcda6d

Browse files
jackwaseyeddelbuettel
authored andcommitted
Abort on R type error if debugging (#860)
* Abort on R type error if debugging * elif should be else * use R function to write to stderr
1 parent e3c8558 commit 7dcda6d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
* inst/include/Rcpp/api/meat/Rcpp_eval.h: Evaluate in base env
1313

14+
2018-06-05 Jack Wasey <[email protected]>
15+
* inst/include/Rcpp/r_cast.h: Error and abort if debugging
16+
1417
2018-06-02 Lionel Henry <[email protected]>
1518

1619
* inst/unitTests/runit.interface.R: New test for the case where

inst/include/Rcpp/r_cast.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,16 @@ namespace Rcpp {
6767
default:
6868
const char* fmt = "Not compatible with requested type: "
6969
"[type=%s; target=%s].";
70+
#ifndef NDEBUG
71+
REprintf(fmt,
72+
Rf_type2char(TYPEOF(x)),
73+
Rf_type2char(RTYPE));
74+
abort();
75+
#else
7076
throw ::Rcpp::not_compatible(fmt,
7177
Rf_type2char(TYPEOF(x)),
7278
Rf_type2char(RTYPE));
79+
#endif
7380
} // #nocov end
7481
return R_NilValue; /* -Wall */
7582
}

0 commit comments

Comments
 (0)