Skip to content

system STL is not useful and should be removed #744

Description

@tangobravo

Description

CppReference suggests <cmath> should overload std::abs with versions taking (and returning) various floating-point types:
https://en.cppreference.com/w/cpp/numeric/math/fabs

With the system STL, this doesn't happen.

The latest NDK default compiler does generate a warning for this [though the suggested fix in the note clearly doesn't work for this STL]:

warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
note: use function 'std::abs' instead
note: include the header <cmath> or explicitly provide a declaration for 'std::abs'

Minimal test project:
https://github.com/tangobravo/ndk-abs-test

Commenting out the following block in app/build.gradle to show it working in with the default STL implementations:

        externalNativeBuild {
            cmake {
                arguments "-DANDROID_STL=system"
            }
        }

There are probably other cmath functions that should have overloads, but it was the abs() one that I was testing at the time when I noticed it. I realise the gnustl and stlport options are being removed, but I believe the system one is still supported as a reasonable "no STL" option (and remains the default with ndkBuild I think) so thought it worthwhile to file a bug.

Environment Details

OS X 10.12.6, Android Studio 3.0.1 [probably not important for this bug]
Using NDK bundle from Android Studio: 17.1.4828580

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions