[Rcpp-devel] Sugar: This is not just a windows issue (partial fix): was sugar under Windows/g++ (MinGW) odd behavior.

Romain Francois romain at r-enthusiasts.com
Tue Jan 25 09:23:16 CET 2011


I'll have a look at this when I get a chance.

Romain

Le 25/01/11 02:58, Dominick Samperi a écrit :
> I reported a problem in another thread that I thought only surfaced
> under Windows,
> but I was wrong (see Subject line). The problem also appears under GCC 4.5+,
> and it appears that somebody already noticed problems with this version of GCC
> and introduced the compiler define IS_GCC_450_OR_LATER to navigate
> around the problematic code.
>
> After some debugging, and based on the links that I posted in the original
> thread, the problem seems to be due to the more recent versions of the
> compilers GCC 4.5+ and VC++ 2010 introducing support for new reference
> features that will not become official until C++0x is released later
> this year (or in 2012).
>
> A partial fix that enables my test drivers to work is to replace
> reference variables by non-references variables in constructors like
> Plus_Vector_Vector. Specifically, the declarations
>
> const LHS_EXT&  lhs;
> const RHS_EXT&  rhs;
>
> should be replaced with
>
> const LHS_EXT lhs;
> const RHS_EXT rhs;
>
> This is a partial fix because I have not checked that this doesn't cause
> other problems with expression evaluation, but it is a start...
>
> The problem with the original code is that the references lhs and rhs
> are initialized to point to a temporary that disappears when the
> constructor exits. This work-around simply saves a copy instead of
> saving a reference.
>
> Dominick

-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://bit.ly/dGAbGu : Back to Stand Up
|- http://bit.ly/fT2rZM : highlight 0.2-5
`- http://bit.ly/gpCSpH : Evolution of Rcpp code size




More information about the Rcpp-devel mailing list