[Rcpp-devel] bool from list: unexpected result and differences between compilers/OSs
Ramon Diaz-Uriarte
rdiaz02 at gmail.com
Tue Jun 23 12:12:01 CEST 2015
Hi Dirk,
On Mon, 22-06-2015, at 13:21, Dirk Eddelbuettel <edd at debian.org> wrote:
> 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
Ooops, I had read (and even known) that in the past.
> 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
Aha. I'll start being more explicit.
Still, are the differences between compilers expected/known?
Best,
R.
> to do it. Also, for bool, you can test explicitly for FALSE (or TRUE, or NA)
> though.
>
> Dirk
--
Ramon Diaz-Uriarte
Department of Biochemistry, Lab B-25
Facultad de Medicina
Universidad Autónoma de Madrid
Arzobispo Morcillo, 4
28029 Madrid
Spain
Phone: +34-91-497-2412
Email: rdiaz02 at gmail.com
ramon.diaz at iib.uam.es
http://ligarto.org/rdiaz
More information about the Rcpp-devel
mailing list