Skip to content
Prev 15444 / 63424 Next

Write Barrier: was: [Rd] function-like macros undefined

Your original question was about macro-like functions.  INTEGER is
available to internal R code as a macro; it is also available as a
function.  Code in packages that uses standard hearders will see the
function, which is declared as

int *(INTEGER)(SEXP x);

I have no idea why you wanted to check whether INTEGER is a macro or
not.  The value returned is a pointer to the raw int data which you
can (ab)use like any other such pointer.
On Wed, 16 Mar 2005, Vadim Ogranovich wrote:

            
The declaration of SET_VECTOR_ELT is

SEXP (SET_VECTOR_ELT)(SEXP x, int i, SEXP v);

Your compiler had better complain about your third argument.
????????
Vectors of non-SEXP objects are not a problem--that is why REAL,
INTEGER, etc are available as functions to access the raw data
pointers.  Only vectors of SEXP's (i.e. generic and character vector
objects) need to go through the write barrier.
This was considered at the time but is not on the table now.

luke