Skip to content

Commit 2411dd9

Browse files
committed
Use DATAPTR_RO in barrier.cpp
1 parent 165f82f commit 2411dd9

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2025-03-07 Dirk Eddelbuettel <[email protected]>
2+
3+
* src/barrier.cpp (dataptr): Replace remaining DATAPTR with
4+
DATAPTR_RO for suitable R greater than 3.5.0
5+
16
2025-02-11 Dirk Eddelbuettel <[email protected]>
27

38
* R/Rcpp.package.skeleton.R (Rcpp.package.skeleton): Support optional

src/barrier.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,13 @@ SEXP* get_vector_ptr(SEXP x) {
7676

7777
// [[Rcpp::register]]
7878
void* dataptr(SEXP x) {
79+
#if R_VERSION >= R_Version(3,5,0)
80+
// DATAPTR_RO was introduced with R 3.5.0
81+
return const_cast<void*>(DATAPTR_RO(x));
82+
#else
83+
// this will get your wrists slapped under recent R CMD check ...
7984
return DATAPTR(x);
85+
#endif
8086
}
8187

8288
// [[Rcpp::register]]

0 commit comments

Comments
 (0)