Skip to content
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

Remove abs(float) function that clashes with std::abs(float) #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

jwakely
Copy link

@jwakely jwakely commented Jan 28, 2017

Depending on which C++ standard library headers have been included there
might an abs(float) function already declared in the global namespace,
so the definition in this file conflicts with it. This cause a build
failure with GCC 7, which conforms more closely to the C++ standard with
respect to overloads of abs.

Including and adding a using-declaration for std::abs ensures
that the standard std::abs(float) function is available. This solution
should be portable to all compilers.

Depending on which C++ standard library headers have been included there
might an abs(float) function already declared in the global namespace,
so the definition in this file conflicts with it. This cause a build
failure with GCC 7, which conforms more closely to the C++ standard with
respect to overloads of abs.

Including <cmath> and adding a using-declaration for std::abs ensures
that the standard std::abs(float) function is available. This solution
should be portable to all compilers.
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.

1 participant