[R] Protecting pointer; Rdefines.h

Thomas Lumley tlumley at u.washington.edu
Thu Jul 4 18:19:43 CEST 2002

On Thu, 4 Jul 2002, In-Sun Nam wrote:

> Dear All,
> I want to protect a pointer instead of its value and hope that someone can
> confirm what I am thinking is okay.
> If I want to assign a pointer "DTIME" as "OrigDTime" then should I do

At least one of us is confused.  PROTECT is only relevant for objects
allocated on the R heap (eg with allocVector, allocString), and prevents
the location on the heap from being garbage collected.

NUMERIC_POINTER() applies to R objects (SEXPs) that are numeric vectors,
and returns an ordinary double * that doesn't need (and can't use)
PROTECTion, so  your suggested code is almost certainly wrong.

If you give more detail as to what you are really trying to do someone may
be able to help.


r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list