Skip to content

How allocate STRSXP outside of gc

1 message · Vadim Ogranovich

#
Thanks Duncan!

R_PreserveObject will do. One thought, wouldn't it make sense to modify
R_PreserveObject to return its argument?
This would allow things like

static SEXP fooSexp = R_PreserveObject(mkChar("foo"));

and would also make R_PreserveObject more similar to Rf_protect().

There should be no problem w/ backward compatability, at least not that
I could see.

Thanks,
Vadim