Skip to content

Use ISNAN() to prevent build error on OS X 10.7 #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 30, 2015

Conversation

peternowee
Copy link

Replace isnan() with R's ISNAN(), as described in Writing R Extensions:

Functions/macros such as isnan, isinf and isfinite are not required by
C++98: where compilers support them they may be only in the std
namespace or only in the main namespace. There is no way to make use
of these functions which works with all C++ compilers currently in use
on R platforms: use R’s versions such as ISNAN and R_FINITE instead.
-- R Core Team,Writing R Extensions: Portable C and C++ code

This prevents the following error when trying to build RMySQL on my
Mac OS X 10.7:

MyBinding.h:100: error: ‘isnan’ was not declared in this scope

Further reading:

Replace isnan() with R's ISNAN(), as described in Writing R Extensions:

> Functions/macros such as isnan, isinf and isfinite are not required by
> C++98: where compilers support them they may be only in the std
> namespace or only in the main namespace. There is no way to make use
> of these functions which works with all C++ compilers currently in use
> on R platforms: use R’s versions such as ISNAN and R_FINITE instead.
> -- [R Core Team,Writing R Extensions: Portable C and C++ code]
> (https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Portable-C-and-C_002b_002b-code)

This prevents the following error when trying to build RMySQL on my
Mac OS X 10.7:

    MyBinding.h:100: error: ‘isnan’ was not declared in this scope

Further reading:
* https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Portable-C-and-C_002b_002b-code
* https://stat.ethz.ch/pipermail/r-devel/2005-January/thread.html#31793
* https://stat.ethz.ch/pipermail/r-devel/2005-January/thread.html#31800
* http://lists.apple.com/archives/Xcode-users/2006/Aug/thrd7.html#00619
* http://lists.apple.com/archives/Xcode-users/2006/Aug/thrd7.html#00633
* http://stackoverflow.com/questions/18128899/is-isnan-in-the-std-namespace-more-in-general-when-is-std-necessary-optio
* http://stackoverflow.com/questions/2249110/how-do-i-make-a-portable-isnan-isinf-function
* http://stackoverflow.com/questions/570669/checking-if-a-double-or-float-is-nan-in-c
hadley added a commit that referenced this pull request Sep 30, 2015
Use ISNAN() to prevent build error on OS X 10.7
@hadley hadley merged commit 6716a73 into r-dbi:master Sep 30, 2015
@hadley
Copy link
Member

hadley commented Sep 30, 2015

Thanks!

@peternowee
Copy link
Author

peternowee commented Sep 30, 2015 via email

@peternowee peternowee deleted the fix-mac-isnan branch October 1, 2015 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants