This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH v2] libstdc++: Add hexfloat/defaultfloat io manipulators.
- From: Andreas Schwab <schwab at linux-m68k dot org>
- To: Jonathan Wakely <jwakely at redhat dot com>
- Cc: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org, RÃdiger Sonderfeld <ruediger at c-plusplus dot de>, Luke Allardyce <lukeallardyce at gmail dot com>
- Date: Tue, 07 Oct 2014 21:10:12 +0200
- Subject: Re: [PATCH v2] libstdc++: Add hexfloat/defaultfloat io manipulators.
- Authentication-results: sourceware.org; auth=none
- References: <20140327133723 dot GA13599 at redhat dot com> <1901588 dot qodTErPe42 at descartes> <20140327162714 dot GA13192 at redhat dot com> <CAFW6PZC0u5=i-KqQZZsbkmg5iWr6u2WVnnBQVqG8V2Bt6oOzOg at mail dot gmail dot com> <20141006155615 dot GN4197 at redhat dot com>
Jonathan Wakely <jwakely@redhat.com> writes:
> diff --git a/libstdc++-v3/src/c++98/locale_facets.cc b/libstdc++-v3/src/c++98/locale_facets.cc
> index 3669acb..7ed04e6 100644
> --- a/libstdc++-v3/src/c++98/locale_facets.cc
> +++ b/libstdc++-v3/src/c++98/locale_facets.cc
> @@ -69,19 +69,26 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> if (__flags & ios_base::showpoint)
> *__fptr++ = '#';
>
> - // As per DR 231: _always_, not only when
> - // __flags & ios_base::fixed || __prec > 0
> - *__fptr++ = '.';
> - *__fptr++ = '*';
> + ios_base::fmtflags __fltfield = __flags & ios_base::floatfield;
> +
> + if (__fltfield != (ios_base::fixed | ios_base::scientific))
> + {
> + // As per DR 231: not only when __flags & ios_base::fixed || __prec > 0
> + *__fptr++ = '.';
> + *__fptr++ = '*';
> + }
>
> if (__mod)
> *__fptr++ = __mod;
> - ios_base::fmtflags __fltfield = __flags & ios_base::floatfield;
> // [22.2.2.2.2] Table 58
> if (__fltfield == ios_base::fixed)
> *__fptr++ = 'f';
> else if (__fltfield == ios_base::scientific)
> *__fptr++ = (__flags & ios_base::uppercase) ? 'E' : 'e';
> +#ifdef _GLIBCXX_USE_C99
> + else if (__fltfield == (ios_base::fixed | ios_base::scientific))
> + *__fptr++ = (__flags & ios_base::uppercase) ? 'A' : 'a';
> +#endif
That cannot work. std::__convert_from_v always passes __prec before
__v, but the format is "%a".
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."