Giter Club home page Giter Club logo

Comments (2)

astrofrog avatar astrofrog commented on August 16, 2024

I think finite should be replaced by isfinite, but not sure whether only very recent compilers support it. If so, we shouldn't make this change yet. Maybe @bluescarni can clarify whether this change would be safe?

from reproject.

bluescarni avatar bluescarni commented on August 16, 2024

@astrofrog isfinite() is a macro available since C99:

http://en.cppreference.com/w/c/numeric/math/isfinite

Quoting from the GCC manpage:

By default, GCC provides some extensions to the C language that on rare occasions conflict with the C standard. See Extensions to the C Language Family. Use of the -std options listed above will disable these extensions where they conflict with the C standard version selected. You may also select an extended version of the C language explicitly with -std=gnu90 (for C90 with GNU extensions), -std=gnu99 (for C99 with GNU extensions) or -std=gnu11 (for C11 with GNU extensions). The default, if no C language dialect options are given, is -std=gnu90; this is intended to change to -std=gnu11 in some future release. Some features that are part of the C99 standard are accepted as extensions in C90 mode, and some features that are part of the C11 standard are accepted as extensions in C90 and C99 modes.

https://gcc.gnu.org/onlinedocs/gcc/Standards.html

So it seems to depend on what kind of compiler flags are passed by distutils down to the compiler, at least in the case of GCC. On OSX I would expect clang to follow more or less what GCC does.

On Windows, MSVC notoriously has poor C99 support, especially in earlier versions (the latest ones seem to have better support).

Pragmatically, for GCC my first choice would be to see if it "just works" in gnu90 mode -- maybe the macro is included in the extensions mentioned above. This seems to be the case on my machine:

#include <math.h>

int main()
{
        isfinite(4.5);
}

This compiles fine on my machine without extra switches (GCC 4.9). This is the type of things that, generally speaking, should be tested when configuring the build system.

from reproject.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.