Skip to content

Documentatio: typo in Writing R Extensions (PR#557)

3 messages · Stephen Eglen, Brian Ripley, Peter Dalgaard

#
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'?

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Tue, 30 May 2000 stephen@anc.ed.ac.uk wrote:

            
It is already `protects' in the current sources (R-devel): I didn't check
1.0.1.  Not sure why you submitted this twice (PR#557 and PR#558)?
#
stephen@anc.ed.ac.uk writes:
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.