Am 16.11.2010 um 09:53 schrieb Enrico Forestieri: > On Tue, Nov 16, 2010 at 07:56:55AM +0100, Stephan Witt wrote: >> The attached patch for http://www.lyx.org/trac/ticket/7026 seems to be >> correct. > > Maybe yes, maybe not. isdigit(c) tests whether c is one of 0,1,2,...,9 > while iswdigit(wc) tests whether wc is a wide-character code representing > a character of class "digit" in the program's current locale. > So, they both return true for 0,1,2,...,9 but iswdigit() returns true also > when isdigit() returns false.
Yes, the only use of hasDigit() is to test if a word contains digits. The spell checker wants to ignore words with digits. Therefor the isdigit() is wrong for digits not represented by ascii 0..9. So, I tend to say that iswdigit() is more correct for this task. Stephan >> The only thing: I don't understand why it should crash with isdigit() >> instead of iswdigit()... > > That could be a platform/compiler related bug. > >> Index: src/support/lstrings.cpp >> =================================================================== >> --- src/support/lstrings.cpp (Revision 36309) >> +++ src/support/lstrings.cpp (Arbeitskopie) >> @@ -323,9 +323,7 @@ >> docstring::const_iterator cit = str.begin(); >> docstring::const_iterator const end = str.end(); >> for (; cit != end; ++cit) { >> - if (*cit == ' ') >> - continue; >> - if (isdigit((*cit))) >> + if (iswdigit((*cit))) >> return true; >> } >> return false; > > -- > Enrico