added a compile time assert to prevent wxArray from compiling when sizeof(long) > sizeof(void *) as it is broken in this case

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15637 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-05-22 18:04:36 +00:00
parent 854a4cc38a
commit acf88ae621

View File

@@ -33,6 +33,11 @@
#define max(a, b) (((a) > (b)) ? (a) : (b))
#endif
// we cast the value to long from which we cast it to void * in IndexForInsert:
// this can't work if the pointers are not big enough
wxCOMPILE_TIME_ASSERT( sizeof(long) <= sizeof(void *),
wxArraySizeOfPtrLessSizeOfLong ); // < 32 symbols
// ============================================================================
// constants
// ============================================================================
@@ -219,7 +224,8 @@ size_t name::IndexForInsert(T lItem, CMPFUNC fnCompare) const \
while ( lo < hi ) { \
i = (lo + hi)/2; \
\
res = (*fnCompare)((const void *)lItem, (const void *)(m_pItems[i])); \
res = (*fnCompare)((const void *)(long)lItem, \
(const void *)(long)(m_pItems[i])); \
if ( res < 0 ) \
hi = i; \
else if ( res > 0 ) \