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

Missing strtold() #12

Open
ksdhans opened this issue Apr 14, 2020 · 1 comment
Open

Missing strtold() #12

ksdhans opened this issue Apr 14, 2020 · 1 comment

Comments

@ksdhans
Copy link

ksdhans commented Apr 14, 2020

Clib2 is missing the strtold() function.

This is resulting in our GCC not having std::strtoi(), etc., because the GCC configuration scripts fail the C99 stdlib test below:

# Check for the existence in <stdlib.h> of lldiv_t, et. al.
AC_MSG_CHECKING([for ISO C99 support in <stdlib.h> for C++11])
AC_CACHE_VAL(glibcxx_cv_c99_stdlib_cxx11, [
  GCC_TRY_COMPILE_OR_LINK(
    [#include <stdlib.h>
     volatile float f;
     volatile long double ld;
     volatile unsigned long long ll;
     lldiv_t mydivt;],
    [char* tmp;
     f = strtof("gnu", &tmp);
     ld = strtold("gnu", &tmp);
     ll = strtoll("gnu", &tmp, 10);
     ll = strtoull("gnu", &tmp, 10);
     ll = llabs(10);
     mydivt = lldiv(10,1);
     ll = mydivt.quot;
     ll = mydivt.rem;
     ll = atoll("10");
     _Exit(0);
    ], [glibcxx_cv_c99_stdlib_cxx11=yes], [glibcxx_cv_c99_stdlib_cxx11=no])
])
AC_MSG_RESULT($glibcxx_cv_c99_stdlib_cxx11)
if test x"$glibcxx_cv_c99_stdlib_cxx11" = x"yes"; then
  AC_DEFINE(_GLIBCXX11_USE_C99_STDLIB, 1,
    [Define if C99 functions or macros in <stdlib.h> should be imported
    in <cstdlib> in namespace std for C++11.])
fi
@ksdhans
Copy link
Author

ksdhans commented Jul 21, 2022

I hit this problem again. Missing bits like this make C++ code less usable, because key parts end up missing.

It should be relatively easy to add, because a long double and double are the same size (i.e., just redirect to strtod()).

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

No branches or pull requests

1 participant