This page gives guidance on porting R code and C packages to work with CXXR, and on some coding practices that may affect the portability of CXXR to different platforms.

R Code

In general, if R code behaves differently under CXXR and under the standard C-based R (in the release of CR on which this release of CXXR is based), then that is a bug in CXXR: please report it. However, differences in timing and in space consumption are to be expected. The following differences are intentional:

Also, there may be differences in the behaviour of R functions which probe into the implementation of the interpreter. In particular:

Moreover, while CXXR is at an alpha development stage, internal logic errors (i.e. errors due to bugs in the interpreter rather than to bugs in the R code it is interpreting) will sometimes cause the interpreter itself to terminate, even in circumstances where CR would manage to recover to the top-level prompt. This is intentional in order to 'preserve the scene of crime' for debugging. Also, typing Control-C will currently cause the CXXR interpreter to terminate, rather than returning to the top-level prompt: if this is a nuisance, change the setting of R_SignalHandlers at around line 824 in main.cpp from 0 to 1, and rebuild.

C Code

Latent memory protection bugs

C and C++ code that appears to work under CR can often contain latent memory protection bugs that will only manifest themselves when a garbage collection occurs at a particular point in execution. Such bugs are very likely to become hard failures under CXXR: refer to this page for advice on diagnosing such bugs.

Mandatory changes for code using R.h or S.h:

Mandatory changes for code using Rinternals.h:

The following changes are required in addition to those listed above for code using .h or S.h:

Suggested changes:

FORTRAN Code

Mandatory changes:

C++ Code

The question of providing additional facilities for external packages written in C++ has not yet been addressed. In particular, although it is intended that in the future such packages will be able to make use of the classes defined in namespace CXXR, the interfaces are in too much flux at present for this to be advisable.

Porting to Other Platforms

The following are areas where portability has been traded for efficiency, simplicity and/or clarity in new code generated for CXXR. There may be other unportabilities in code inherited from CR.