[Rcpp-devel] sugar under Wingows/g++ (MinGW) odd behavior.

Dominick Samperi djsamperi at gmail.com
Thu Jan 13 16:29:20 CET 2011


The template expression code is very interesting, but it
does not work as expected under
Windows/g++/MinGW/32bit/Rterm.exe. The problem
does not appear when I use Rgui.exe, or if I use
64bit Windows!

Consider the following C++ code called using
.Call('testsugar',1:5,1:5):

RcppExport SEXP testsugar(SEXP x_, SEXP y_) {
    Rcpp::NumericVector x(x_), y(y_);
    Rprintf("%d, %lf, %lf\n", (x+y).size(), (x+y)[0], (x+y)[1]);
    return R_NilValue;
}

Under Linux/GCC, or 64bit Windows/g++, or
32bit Windows/g++ I get the expected result:

5, 2.0, 4.0

Under Windows/32bit/Rterm.exe I get:

5, 0.0, 0.0

(Under VC++ there are more serious problems including
corruption of other in the wrap-up function
Vector(VectorBase& other), but since VC++ is not
supported I will not elaborate here.)

Thanks,
Dominick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110113/9bf1511f/attachment.htm>


More information about the Rcpp-devel mailing list