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: Rethinking... (Re: RFC: fp printing speedup...)


On Fri, Nov 14, 2003 at 08:52:28AM +0100, Paolo Carlini wrote:
> Nathan Myers wrote:
> 
> >>If the standard does intend this to be the case, then we don't need to
> >>loop with widen(char) and can use the array form instead.
> >
> >Absolutely you can use the array form. Anybody who suggested that
> >anything should work right when widen gives different results for
> >single char and array forms would be laughed off the list.
> 
> I don't follow: have you seen libstdc++/12988? Whatever we do as regards
> cache management, if we don't use in any case the single char form, how we
> can imagine fixing the bug? A user cannot be forced to always override both
> forms in the same way and 22.2.2.2.2, p14 is clear about which form must be
> called!

Any difference in behavior between the single-character and array
forms of facet members is a user error.  If it doesn't say so 
clearly enough in the standard, that's a Defect.  Enter a Defect 
Report on the subject.  Mark 12988 as "not a bug", and reference 
the DR.  

We're not obliged to make our library stupidly slow just because 
the standard missed identifying, in detail, yet another way that 
a user could do something obviously wrong.  

If you want to go language-lawyer on the subject, 22.2.1.1.2 p11
says that both forms of do_widen() "appl[y] the simplest reasonable 
transformation...".  If they differ, then which one performs the 
simplest reasonable transformation?  One or other (or both) must
be wrong.  You cannot expect the library to behave correctly when 
user-supplied components violate the requirements.  That is, once
the user breaks the library, it's broken, and *none* of the details
can be counted on.  It's allowed to erase your disk and impregnate
your sister.  Ultimately, the "as-if" rule applies.

I object to any patches that treat 12988 or its ilk as other than a 
DR.  The array forms of the facet members are present *specifically* 
to allow optimal treatment of arrays of characters.  To avoid using
them just for the sake of excessive language-lawyerism benefits no one.

That said, Jerry is right that the widening should happen once and
be cached somewhere, so that the time it takes to do the conversion
doesn't matter.  

Nathan Myers
ncm-nospam@cantrip.org


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