[Rd] R_MakeExternalPtr
TB
thomas.baier at kirchnersoft.com
Mon Oct 24 10:38:33 CEST 2005
Brian,
Prof Brian Ripley <mailto:ripley at stats.ox.ac.uk> wrote:
> This is one of those undocumented things (AFAIK): LENGTH applies only
> to 'vectors'. So don't use t and definitely don't set it for others.
> The macro expands to
>
> #define LENGTH(x) (((VECSEXP) (x))->vecsxp.length)
>
> What is a vector here? Something which gets actually allocated by
> allocVector() AFAICS, that is an atomic or generic vector or an
> expression. OTOH, an EXTPTRSXP is stored in a cons cell.
>
> There is also a function length(), which is safer.
Thanks for your message. Things are much clearer now to me.
Can I safely assume that INTSXP, REALSXP, LGLSXP, STRSXP, CPLXSXP and VECSXP
are
vectors (while EXTPTRSXP is not).
Thomas
More information about the R-devel
mailing list