Stephan Witt wrote:

> Am 03.12.2010 um 04:36 schrieb Enrico Forestieri:
> 
>> It's becoming a mess. We have isdigit(), isDigit(), isDigitASCII(),
>> and now iswdigit() enters the scene.
> 
> iswdigit() is POSIX standard for wchar_t arguments - our char_type
> is a typedef of wchar_t. But I don't insist here.

Not on windows. I agree with Enrico: iswdigit is wrong (and it is not used 
in my patch in trac). This is even more general: None of the wide string 
functions should be used, because they would only work on OSes that use UCS4 
encoding for wstring and a 32bit wchar_t

>> Too many of those functions, too much confusion.
>> We should start clearing up things.
> ...
>> So, IMHO, we should:
>> 1) ban isdigit() [use isDigitASCII() instead]

That was the first part of my patch.

>> 2) replace all occurrences of isDigit() with isDigitASCII()

I don't know. Unless somebody goes through all usages and confirms that 
indeed an ASCII digit is wanted I would rather keep it as it is.

>> 3) use QChar::isNumber() instead of iswdigit().
> 
> I'd have no problem with this. My goal was to get the thing fixed.
> IMHO, a wrapper around QChar::isNumber() in textutils.h and lstrings.cpp
> should be added then.

If you want to use QChar::isNumber() for the spell checking test: Why not. 
Unless somebody comes up with an example I believe that it basically does 
not matter whether isDigit(), isDigitASCII() or QChar::isNumber() is used 
there. Whatever you decide, please ensure that hasDigit() gets renamed 
properly.


Georg

Reply via email to