Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

_UU asymmetry [resolved]

(1/1)

me22:
Gah, I get busy with school and the unicode linux build breaks again :P

Anyways, src/sdk/settings.h currently contains

--- Code: ---#if wxUSE_UNICODE
    #define _UU(x,y) wxString((x),(y))
    #define _CC(x,y) (x).mb_str((y))
#else
    #define _UU(x,y) (x)
    #define _CC(x,y) (x)
#endif

--- End code ---

I think it should be changed to:

--- Code: ---#if wxUSE_UNICODE
    #define _UU(x,y) (wxString((x),(y)))
    #define _CC(x,y) ((x).mb_str(y))
#else
    #define _UU(x,y) (wxString(x))
    #define _CC(x,y) (x)
#endif

--- End code ---

Rationale:
src/sdk/configmanager.cpp contains the line

--- Code: ---wxString(_U(curr->Value())).Mid(1).ToLong(&tmp);
--- End code ---

Which apparently doesn't work:
configmanager.cpp: In member function `void ConfigManager::Read(const
   wxString&, ConfigManagerContainer::IntToStringMap*)':
configmanager.cpp:1129: error: syntax error before `.' token
configmanager.cpp:1130: error: no match for call to `(wxString) (const char*,
   wxMBConvUTF8&)'
/usr/include/wx-2.6/wx/string.h:989: error: candidates are: wxString
   wxString::operator()(unsigned int, unsigned int) const

Apparently the missing parens were causing some problems with parsing the constructor call.  Also, it illustrates that the two different _UU definitions give objects of different types ( one is char*, the other wxString ) which violates LeastAstonishment.

I suggest the line be changed to

--- Code: ---_U(curr->Value()).Mid(1).ToLong(&tmp);
// becoming
wxString(curr->Value()).Mid(1).ToLong(&tmp);
// or
wxString((curr->Value()),(wxConvUTF8)).Mid(1).ToLong(&tmp);
// after the preprocessor gets to it

--- End code ---
in conjunction with the _UU changes mentioned above.

[edit] A few changes to hopefully get it applied sooner =)

Navigation

[0] Message Index

Go to full version