Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

wxIsalpha issue in tokenizer

(1/1)

ollydbg:

--- Code: ---    wxChar a = _T('中');
    if(wxIsalpha(a))
    {
        ....
    }

--- End code ---
The if clause will run. We have such code:

--- Code: ---wxString Tokenizer::DoGetToken()
{
    int start = m_TokenIndex;
    bool needReplace = false;

    wxString str;
    wxChar   c = CurrentChar();

    if (c == '_' || wxIsalpha(c))
    {
        // keywords, identifiers, etc.

        // operator== is cheaper than wxIsalnum, also MoveToNextChar already includes IsEOF
        while (    ( (c == '_') || (wxIsalnum(c)) )
               &&  MoveToNextChar() )
            c = CurrentChar(); // repeat

        if (IsEOF())
            return wxEmptyString;

        needReplace = true;
        str = m_Buffer.Mid(start, m_TokenIndex - start);
    }

--- End code ---

I'm not sure the Chinese character entered in code will cause some problem.

Like: Re: ² character bug

MortenMacFly:

--- Quote from: ollydbg on March 29, 2012, 03:51:47 am ---I'm not sure the Chinese character entered in code will cause some problem.

--- End quote ---
Well I believe we had that just recently - IMHO the compiler will compile code that uses non-ASCII characters for variable / function names. No the assumption is correct. Its not nice and actually ugly and evil - but its not an error.

Navigation

[0] Message Index

Go to full version