[Rcpp-devel] Using C++0x in g++ changes ifelse behaviour

Darren Cook darren at dcook.org
Tue Aug 16 05:02:31 CEST 2011


> I just tried and could _not_ replicate it. I just uncommented my standard
> line with the flag in ~/.R/Makevars:
> 
> CXXFLAGS= -std=c++0x -g -O3 -Wall -pipe -pedantic -Wno-variadic-macros 

Thanks Dirk.
I tried with your line and it works for me too. So I tried shortening it
and this works:
  CXXFLAGS= -std=c++0x -g -O3

but this does not:
  CXXFLAGS= -std=c++0x -g

This also does not work:
  CXXFLAGS= -std=c++0x -g -Wall -pipe -pedantic -Wno-variadic-macros

And neither does this:
  CXXFLAGS= -g -Wall -pipe -pedantic -Wno-variadic-macros

I.e. c++0x was a red herring, and the lack of -O3 is the problem. It
works with -O3, -O2, -O1 and -Os, but fails to work with -O0.

Very curious. I considered trying each of the individual optimization
flags [1], to narrow it down further, until I realized how many of them
there were.

Darren

[1]: http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html


-- 
Darren Cook, Software Researcher/Developer

http://dcook.org/work/ (About me and my work)
http://dcook.org/blogs.html (My blogs and articles)


More information about the Rcpp-devel mailing list