This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [Patch] Clean up and reformat to config/numeric and time
- From: Martin Sebor <sebor at roguewave dot com>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Thu, 17 Jun 2004 13:57:27 -0600
- Subject: Re: [Patch] Clean up and reformat to config/numeric and time
- References: <40D1D1DC.5040104@suse.de>
Paolo Carlini wrote:
Hi,
the second half of the patch is straightforward: it uses an union
(consistently with numeric) instead of reinterpret_cast in order to
avoid *a lot* of overlong lines.
The first hunk is slighlty less trivial, I would appreciate a look
over it. We had:
union __s_and_w { const char *__s; unsigned int __w; } __u;
__u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
_M_data->_M_decimal_point = static_cast<wchar_t>(__u.__w);
I changed it to:
union { char *__s; wchar_t __w; } __u;
__u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
_M_data->_M_decimal_point = __u.__w;
Interesting. This is quite similar to our own implementation (we
also store the wchar_t representation internally, just as glibc
appears to, but we store it in int32_t for better portability).
Just a quick observation (it may or may not be relevant): the
cast might be important if wchar_t is not the same size as int,
e.g., with -fshort-wchar. But if this code is tied to glibc
where wchar_t is always the same size as int (and if libstdc++
doesn't allow -fshort-wchar) it should be safe.
Martin