Displaying 1 result from an estimated 1 matches for "duse_rinternals".
Did you mean:
use_rinternals
2008 Mar 31
1
(PR#11054) "Writing R Extensions": bad example with CAR
...ort <Rinternals.h>
int main() {
SEXP a, b;
// ...
CAR(a) = b;
}
--8<---
If I compile this with "gcc -I <path to R 2.6.2> foo.c", I get the error
"invalid lvalue in assignment", while it compiles without error if I
specify the compiler option "-DUSE_RINTERNALS".
Looking at the output of the preprocessor output reveals that without
USE_RINTERNALS, the line "CAR(a)=b" stays as it is, i.e. presents the
compiler with a function call as l-value, while with USE-RINTERNALS, it
gets macro-expanded to "((a)->u.listsxp.carval) = b",...