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 libstdc++/13341 (speed-up <wchar_t>::do_narrow/widen)


On Fri, Dec 12, 2003 at 09:20:57AM +0100, Paolo Carlini wrote:
> >Why not cache all 256 widen chars rather than just 128? We already
> >know all the source possibilities, unlike in do_narrow().
> 
> Good point. However, I think we want to keep those table as small as
> possible. Also, there are some trickeries with char signedness (eh!;)

It's necessary, and value-conserving, to cast any actual character 
value to unsigned char.  Correct use of the C library ctype functions
e.g. isdigit() requires that cast, e.g. isdigit((unsigned char)c) for
values of c that might be outside the ASCII range.

The widen and narrow members have the unusual property, among
functions that operate on characters, that they only produce
interesting results for characters that are in the "basic execution
character set" (2.2).  It includes a few control characters --
tab, vt, ff, nl, bel, bs, cr, and nul -- the alphanumerics, the 
various cussword symbols excepting @ and $, and punctuation.  They 
are all guaranteed to be non-negative when stored in a character,
at least in the default "C" or "POSIX" locale.

I don't know if this is helpful or entirely beside the point.

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]