----Original Message---- >From: Daniel Berlin >Sent: 12 July 2005 17:33
>> I think that even if the use of relational operators other than '==' and >> '!=' is legal with pointers, the compiler should issue a warning (when >> the option -Wall is used), as it does for assignment, used as truth >> values, not surrounded with parentheses. > > Why? > It's legal, it's useful, and used. > > --Dan Just to enlarge upon Dan's comment: Since pointer subtraction is well defined, and it returns an int, then ... int *a, *b; if (a < b) dosomething (); ... is just the same as ... int *a, *b; if ((b - a) >= 0) dosomething (); ... so do you think the compiler should warn about _all_ pointer arithmetic? cheers, DaveK -- Can't think of a witty .sigline today....