Author Topic: _UU asymmetry [resolved]  (Read 5707 times)

Offline me22

  • Official tester
  • Multiple posting newcomer
  • ***
  • Posts: 53
    • TA Universe
_UU asymmetry [resolved]
« on: December 02, 2005, 12:27:38 am »
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

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

Rationale:
src/sdk/configmanager.cpp contains the line
Code
wxString(_U(curr->Value())).Mid(1).ToLong(&tmp);

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
in conjunction with the _UU changes mentioned above.

[edit] A few changes to hopefully get it applied sooner =)
« Last Edit: December 03, 2005, 06:28:00 am by me22 »