I am getting the below error in linux arm architecture when trying to compare void pointer addr>(void *)0XFFFE00000000 .Here addr is of type void pointer error: ordered comparison of pointer with null pointer [-Werror=extra]
This is happening only in Linux arm architecture,in other architecture it is working fine
addr>(void *)0XFFFE00000000
How to solve this?
Probably the integer literal is overflowing into 32 bits, which becomes 0 or NULL
.
But you shouldn't go around comparing random (void
) pointers for being greater than some random integer, anyway. Cast the pointer to uintptr_t
, and make sure the literal is of a suitable type too, then it starts becoming more likely to work. There doesn't seem to be a UINTPTR_C()
macro, but perhaps it makes sense to use UINTMAX_C()
?
Of course, if your unspecified "ARM" is 32-bit, then the address is way out of bounds and probably larger than the pointers will be ... quite confusing.