[GenABEL-dev] Fwd: CRAN packages with C++11 errors on isnan or isinf
Yurii Aulchenko
yurii.aulchenko at gmail.com
Sun Nov 10 09:23:16 CET 2013
fyi
---------- Forwarded message ----------
From: Prof Brian Ripley <ripley at stats.ox.ac.uk>
Date: Sun, Nov 10, 2013 at 9:19 AM
Subject: CRAN packages with C++11 errors on isnan or isinf
To: Yurii Aulchenko <yurii at bionet.nsc.ru>, Daniel Taliun <
Daniel.Taliun at eurac.edu>, Cedric E Ginestet <cedric.ginestet at kcl.ac.uk>,
Philip Johnson <plfjohnson at emory.edu>, Franck Picard <
franck.picard at univ-lyon1.fr>, The Minh Luong <luongtm at yahoo.com>
Cc: CRAN <CRAN at r-project.org>
This concerns packages
DatABEL GWAtoolbox GenABEL LDExplorer NetworkAnalysis adaptivetau cghseg
postCP
for which we have reported errors on g++ 4.8.x (and clang++ using g++
headers showing on the CRAN check pages) like
CastUtils.cpp: In function 'bool checkNan(void*, int)':
CastUtils.cpp:189:38: error: call of overloaded 'isnan(double&)' is
ambiguous
return isnan(*(double*) data);
isnan is a macro in C99 included in <math.h>.
isnan is a function in C++11 in <cmath>, overloaded for float, double and
long double and maybe more types.
In tracking down a similar issue we found it was due to including both
<math.h> and <cmath>. That package did so explicitly, but it is easy for
this to be done by other headers you include.
A remedy was to use std::isnan if you want the C++11 version and ::isnan if
you want the C99 version. But note that C++98 (the default standard)
includes neither, so the most portable thing to do is to use R's ISNAN via
header <R.h> (and for safety include that header after all the system ones).
isinf is analogous, with R_FINITE available.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
--
-----------------------------------------------------
Yurii S. Aulchenko
[ LinkedIn <http://nl.linkedin.com/in/yuriiaulchenko> ] [
Twitter<http://twitter.com/YuriiAulchenko>] [
Blog <http://yurii-aulchenko.blogspot.nl/> ]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/genabel-devel/attachments/20131110/16591299/attachment.html>
More information about the genabel-devel
mailing list