Displaying 1 result from an estimated 1 matches for "xiptr".
Did you mean:
iptr
2005 Mar 16
3
Write Barrier: was: function-like macros undefined
Hi,
Thank you to Duncan Murdoch for pointing to
http://www.stat.uiowa.edu/~luke/R/barrier.html.
I have a couple of questions in this regard:
* suppose that inside a C function I have a SEXP vector x of integers
and I want to increment each element by one. I understand that
int * xIPtr = INTEGER(x);
int i;
for (i=0; i<LENGTH(x); ++i)
SET_VECTOR_ELT(x, i, xIPtr[i]+1);
is the recommended way of doing it. However it seems that only the very
first call to SET_VECTOR_ELT, i.e. the one that corresponds to i=0, is
strictly necessary. For example, and this is my question, the...