File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -14639,6 +14639,17 @@ directly would violate assumptions the memory manager depends on.
1463914639@code{DATAPTR_RO} returns a generic read-only data pointer for any
1464014640vector object.
1464114641
14642+ @strong{N.B.} These will return a valid data pointer only for vectors of
14643+ positive length. Zero-length vectors have no `data' and these accessors
14644+ will usually return an invalid pointer, for example to address
14645+ @code{0x000000000001}. So usages such as
14646+ @example
14647+ memcpy(REAL(newx), REAL_RO(x), LENGTH(x) * sizeof(double));
14648+ @end example
14649+ @noindent
14650+ are undefined behaviour without a prior check on the length of @code{x}.
14651+ @c Returning 0x000000000001 was inroduced in R 4.5.0.
14652+
1464214653Formerly it was possible for packages to obtain internal versions of
1464314654some accessors by defining @samp{USE_RINTERNALS} before including
1464414655@file{Rinternals.h}. This is no longer the case. Defining
You can’t perform that action at this time.
0 commit comments