[Rd] Documentatio: typo in Writing R Extensions (PR#557)
Peter Dalgaard BSA
p.dalgaard@biostat.ku.dk
30 May 2000 12:40:17 +0200
stephen@anc.ed.ac.uk writes:
> Full_Name: stephen eglen
> Version: 1.0.0
> OS: Unix (OSF/1)
> Submission from: (NULL) (129.215.238.26)
>
>
> Hi,
> in the documentation `Writing R Extensions', the section 3.6.1 (handling the
> effects of garbage collection) has the following typo:
>
> Protecting a SEXP pointer protexts ...
>
> Should that be `protects'?
Yup. Already fixed in the development version.
Actually "SEXP pointer" is a bit like "ATM machine". SEXPs are
pointers to SEXPREC, so is a SEXP pointer a (SEXPREC **) ? Besides,
one is not protecting the pointer but the object it points to (by
putting a pointer to it on the protection stack). This is
a common misconception:
PROTECT(p);
...
p = AllocSexp(....);
will not protect the new value of p. You need
PROTECT(p);
...
UNPROTECT(1);
PROTECT(p = AllocSexp(....));
Hmm. Looks like the whole section needs going over. The stuff about
"ensuring that the pointer is updated" is bogus too (it is VECRECs
that move, not SEXPRECs). And the description of UNPROTECT_PTR is
vacuous at best.
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._