Skip to content

Remove #define USE_RINTERNALS #3301

@mattdowle

Description

@mattdowle

With ALTREP in R 3.5+ it's no longer true that defining USE_RINTERNALS before including Rinternals.h makes REAL(), INTEGER() etc into macros. That's why I did it originally and it's no longer true, so there's no point in doing it anymore. It was good advice because it was a lot faster. The new advice with R 3.5+ is to not use the R API inside loops.
See also: #2866 (comment) and #3188 (comment)

Section 5.14 of R-exts manual contains :

If efficiency is essential, the internal versions of the accessors can be obtained by defining ‘USE_RINTERNALS’ before including Rinternals.h. If you find it necessary to do so, please do test that your code compiles without ‘USE_RINTERNALS’ defined, as this provides a stricter test that the accessors have been used correctly. Also be prepared to adjust your code should R internals change.
The accessor functions, and other functions in the R API, are also subject to change to support the ‘ALTREP’ project (https://svn.r-project.org/R/branches/ALTREP/ALTREP.html). Code that does not define ‘USE_RINTERNALS’ should not be affected by these changes, but code that does define ‘USE_RINTERNALS’ may need to be adjusted.

I've tried turning off USE_RINTERNALS and data.table compiles and passes all tests with latest versions of R because DATAPTR is exposed in the R API. But still we're not supposed to use it. Not passing R 3.1.0 until DATAPTR is removed (72 22 calls) :

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions