Jul 20, 2012 at 2:03pm
I'm having the following error at the following line:
if( ( (res >> i*8) ^ cmp[i] ) != 0x00)
the error is:
error: invalid operands of types 'void*' and 'int' to binary 'operator>>'|
res is of type void*
i is of type int
cmp is of type char*
all variables have the required space allocated.
Can you please help me figure out what's wrong?
Last edited on Jul 20, 2012 at 2:04pm
Jul 20, 2012 at 2:06pm
You can't use bit operations on pointers. What exactly are you trying to do?
Jul 20, 2012 at 4:00pm
Oh, sorry, i didn't knew... Thanks for the info.
Jul 20, 2012 at 7:42pm
Maybe it's something like one of those xor linked lists?
Anyway, to compile that,
if( ( (reinterpret_cast<std::uintptr_t>(res) >> i*8) ^ cmp[i] ) != 0x00)
If you don't have uintptr_t (it comes from cstdint in C++11 and from stdint.h in C99), size_t will likely work as well.
Last edited on Jul 20, 2012 at 7:44pm