Mirco Lorenzoni wrote: >Can a pointer appear in a C/C++ relational expression which doesn't test the >equality (or the inequality) of that pointer with respect to another pointer? >For example, are the comparisons in the following program legal code? > >/* test.c */ >#include <stdio.h> > >int main(int argc, char* argv[]) >{ > void *a, *b; > int aa, bb; > > a = &aa; > b = &bb; > > > Actually I'm fairly certain at this point this program stops being legal code, as (I believe) you can only compare pointers which are from the same allocation (be that an array, malloc, etc).
However, comparing pointers with < is something I do all the time when writing various kinds of algorithms. For what reason would you want to see it warned about? Chris