wxDataViewItem::m_id type confusion

Vadim Zeitlin vadim at wxwidgets.org
Sat Mar 1 07:43:03 PST 2008


 Hello (Robert),

 Could you please explain what is wxDataViewItem::m_id under different
platforms? It's declared as pointer but it is used as an integer in
wxDataViewModel::Compare(). Does it really have to be a pointer (for Mac?)?
In this case we need to replace "unsigned int" in the API with wxUIntPtr as
"unsigned int" is not big enough to hold a pointer under Win64 (but
wxUIntPtr is) and this results not only in compiler warnings (which is
annoying enough on its own) but will also break the code if the pointers
are ever used under MSW.

 There is also something very strange going on with m_hash and m_useHash
in wxDataViewIndexListModel. The latter is always false under Mac AFAICS
but why then do we even compile all the code using m_hash there? I'm not
worried about inefficiency here as much as about code clarity: having 2
versions of each function isn't really ideal IMO. Why not provide 2
versions of the (base) class, one using the array and the other one not
using it?

 And as a final question, shouldn't we use wxVector instead of
WX_DEFINE_ARRAY in this (new) code?

 Thanks,
VZ





More information about the wx-dev mailing list