On 22 June 2015 at 10:25, Ramon Diaz-Uriarte wrote: | | Dear All, | | Accessing an element of a list that should be TRUE/FALSE does not recognize | the boolean properly in Windows/gcc-4.6.3 unless I use "as". It does the | same surprising thing in Debian Linux with gcc-4.6.4. | | But it does do what I expect in Linux, with both gcc (4.9.2) and | clang++-libc++ (3.5.2-1). In Windows, I am using Rtools33.exe, the latest | Rtools.exe (downloaded last night). | | | | Given the above, is it the proper way to proceed to always use "as<bool>"? | Or, just being extra careful, should we "as<whatever>" (double, int, etc)?
R has TRUE, FALSE and NA in a logical -- three values. That can breaks automagic conversion to bool. So I think as<bool> is a safe bet here. In general, in does not hurt to help the compiler -- but you don't always have to do it. Also, for bool, you can test explicitly for FALSE (or TRUE, or NA) though. Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel