This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: strtold() availability


On Mar 10 16:34, VÃclav Zeman wrote:
> On 10 March 2014 11:39, Corinna Vinschen wrote:
> > On Mar 10 10:11, VÃclav Zeman wrote:
> >> On 7 March 2014 21:08, Corinna Vinschen wrote:
> >> > On Mar  7 17:04, VÃclav Zeman wrote:
> >> >> Hi.
> >> >>
> >> >> This bit from /usr/include/stdlib.h hides the `strtold()` function
> >> >> even though the `strtold` symbol appears to be exported from
> >> >> `cygwin1.dll`:
> >> >>
> >> >> ~~~~{.c}
> >> >> /* On platforms where long double equals double.  */
> >> >> #ifdef _LDBL_EQ_DBL
> >> >> #if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L) ||
> >> >> (__cplusplus >= 201103L)
> >> >> extern long double strtold (const char *__restrict, char **__restrict);
> >> >> #endif
> >> >> #endif /* _LDBL_EQ_DBL */
> >> >> ~~~~
> >> >>
> >> >> This in turn breaks my source because I cannot use `_GLIBCXX_USE_C99`
> >> >> to expose some C++11 features like `std::vsnprintf()`.
> >> >>
> >> >> Shouldn't the `_LDBL_EQ_DBL` guard be removed and the function exposed
> >> >> regardless of `double` and `long double` sizes?
> >> >
> >> > I fixed that in newlib after a discussion with my co-maintainer.
> >> > strtold now gets defined if _HAVE_LONG_DOUBLE is defined.  This is
> >> > the case for Cygwin, for instance.
> >>
> >> I think that similar fix needs to be applied to `wchar.h` and `wcstold()`.
> >
> > Not yet.  Newlib doesn't provide wcstold, only wcstod.
> 
> I see this in `/usr/include/wchar.h`:
> 
> ~~~~{.c}
> /* On platforms where long double equals double.  */
> #ifdef _LDBL_EQ_DBL
> long double _EXFUN(wcstold, (const wchar_t *, wchar_t **));
> #endif /* _LDBL_EQ_DBL */
> ~~~~

Yes.  And looking into the wcstold source you'd have seen this:

  /* On platforms where long double is as wide as double.  */
  #ifdef _LDBL_EQ_DBL
  long double
  wcstold (const wchar_t *__restrict nptr, wchar_t **__restrict endptr)
  {
    return wcstod(nptr, endptr);
  }
  #endif /* _LDBL_EQ_DBL */


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: pgpwHADIcXwKm.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]