In your first example, you are comparing two UInt32* pointers which should
never be equal. In the second example, you are getting the pointers and
then comparing what they point at, which seems more useful.
"Carl" <Ca**@discussions.microsoft.com> wrote in message
news:EB**********************************@microsof t.com...
Hi,
I have an array of bytes like
Byte m_Data[] = new Byte[2000] ;
Byte sequences starting at a random index (4 byte aligned) should be
interpreted as unsigned long values and compared with each other.
My first try was
if ( reinterpret_cast<UInt32*>(&m_Data[20]) ==
reinterpret_cast<UInt32*>(&m_Data[104]) )
{ ... }
but the results were not always as expected (guess due to the == operator
handling the pointers).
The second try was
__value UInt32* a = reinterpret_cast<__value UInt32*>(&m_Data[20] ) ;
__value UInt32* b = reinterpret_cast<__value UInt32*>(&m_Data[104]) ;
if ( *a == *b )
{ ... }
That seems to work, but I dislike the need of extra variables (due to
performance reasons).
Has someone a really good idea about that?
Thanks
Carl