Skip to content

Commit 72f4db1

Browse files
committed
Add comments
1 parent 3fa6ca0 commit 72f4db1

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

inst/include/Rcpp/protection/Shield.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ namespace Rcpp{
2626
}
2727

2828
inline void Rcpp_unprotect(int i){
29+
// Prefer this function over UNPROTECT() in Rcpp so that all
30+
// balance checks errors by rchk are contained at one location (#892)
2931
UNPROTECT(i);
3032
}
3133

inst/include/Rcpp/vector/no_init.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ class no_init_vector {
3737

3838
template <int RTYPE>
3939
operator Vector<RTYPE, PreserveStorage>() const {
40+
// Explicitly protect temporary vector to avoid false positive
41+
// with rchk (#892)
4042
SEXP x = PROTECT(Rf_allocVector(RTYPE, size));
4143
Vector<RTYPE, PreserveStorage> ret(x);
4244
UNPROTECT(1);

0 commit comments

Comments
 (0)