Re: [Rd] R strings, null-terminated or size delimited?

From: Simon Urbanek <>
Date: Sat, 21 Nov 2009 17:27:58 -0500

On Nov 21, 2009, at 4:12 PM, Guillaume Yziquel wrote:

> Hello.
> I've been looking at vecsexps for my binding.
> Concerning strings, I'm wondering: are they supposed to be null-
> delimited?

Yes, they are null-delimited when you create/access them.

> Are they delimited by the info in the SEXPHEADER macro in
> Rinternals.h?

You should not be touching or reading that.

> Basically, what are the macros or functions to access the values of
> the vecsexps?

VECTOR_ELT and SET_VECTOR_ELT (assuming that you're referring to VECSXP which is are generic vectors).

> I'm thinking of CHARSXPs and INTSXPs for the moment...

Those are entirely different - CHARSXP are not vectors but strings (see mkChar et al., CHAR, ...) and INTSXP are integer arrays (in C speak) accessed using INTEGER.

Please read R-exts - it's better than guessing.

Simon mailing list Received on Sat 21 Nov 2009 - 22:35:51 GMT

This archive was generated by hypermail 2.2.0 : Sun 22 Nov 2009 - 00:50:36 GMT