Tool/software: TI C/C++ Compiler
Hi,
according to c/c++ standards, comparison of two pointers of different structure is undefined.
from internet(:/):
"If two pointers p
and q
of the same type point to different objects that are not members of the same object or elements of the same array or to different functions, or if only one of them is null, the results of p<q
, p>q
, p<=q
, and p>=q
are unspecified."
i wonder what is a proper way of deciding if a pointer is falling between two absolute addresses? is the following code valid in C2000 compiler?
int* p;
p = (int*)(some value from a byte stream);
if ( p >= (int*)0x8000 && p<=(int*)0x9000)
{do something}
thanks
regards
gzhang