This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: [Patch] Fix the narrow/widen problem in money_get::do_get


Paolo Carlini wrote:

Martin Sebor wrote:

As I said on the reflector the last time we discussed the issue,
an efficient but mainly simpler implementation is possible (and
exists -- ours) that calls narrow(), not widen(). Additionally,
as I also pointed out in the past, the requirement Paolo refers
to above is unimplementable for any specialization of these
facets other than on char and wchar_t, and implementations that
follow it only violate the standard in another area.


Honestly, I don't follow. It seems to me pretty clear that the standard
talks about widen, not about narrow (see note 237!?!)

That's true. But existing practice suggests that the requirement is bogus -- no implementation that I know of has ever followed it.

and we don't
really care what an user of the library want to do for types != char,
wchar_t (Table 51).

You should care. Look at table 52. A conforming implementation is required to make it possible to instantiate money_get, money_put, num_get, and num_put on any POD character type.

Moreover, I don't see DRs involving 22.2.6.1.2.

If there isn't one it's only because no one has filed it yet.


The "missing traits" problem has been discussed a bunch of
times. The only thing facets need traits for is character
comparison. Unless we add a traits parameter to the facets
that need it, the only two ways to solve the problem are
to require that charT's be equality-comparable (no such
requirement currently exists) or to have xxx_get<charT>::
do_get() call ctype<charT>::narrow() and compare the narrowed
down versions of the charT's. Actually, I suggested a third
approach -- have the facets look for a traits_type typedef
in the charT type and use it if it exists, and otherwise use
std::char_traits<char>. This approach didn't meet with much
enthusiasm, but neither was there a clear preference for
either of the other two.

Martin


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