[wx-dev] wxDataViewItem::m_id type confusion

Vadim Zeitlin vadim at wxwidgets.org
Sat Mar 1 15:33:51 PST 2008


On Sat, 01 Mar 2008 18:36:55 +0100 Robert Roebling wrote:

RR> Vadim Zeitlin wrote:
RR> 
RR> >  Could you please explain what is wxDataViewItem::m_id under different
RR> > platforms? It's declared as pointer
RR> 
RR> Yes, e.g. for storing user data, which is typically a pointer.

 Ok, I see, thanks.

RR> > In this case we need to replace "unsigned int" in the API with wxUIntPtr
RR> > as "unsigned int" is not big enough to hold a pointer under Win64
RR> 
RR> Not quite sure what you mean. The pointer should be able to hold
RR> an int (and it is), where do we need the opposite?

 E.g. wxDataViewIndexListModel::GetRow() returns unsigned int. OTOH it
looks like ids of the items are always integers for this model so the
truncation is probably ok. I'd still prefer to use wxUIntPtr just to be on
the safe side though.

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

 Hmm, could you please point me where does this happen? I only see
m_useHash being used in datavcmn.cpp.

RR> >  And as a final question, shouldn't we use wxVector instead of
RR> > WX_DEFINE_ARRAY in this (new) code?
RR> 
RR> wxVector probably wasn't finished then. I'm also not sure 
RR> what support for sorting we have in wxVector without STL.

 As you added wxQsort() anyhow we can use it with wxVector.

 Regards,
VZ





More information about the wx-dev mailing list