Manuel López-Ibáñez wrote: > On 20/09/2007, Doug Gregor <[EMAIL PROTECTED]> wrote: >> We can't seem to decide whether ISO C++ really forbids comparisons >> between pointers and integers or not. The first two are for == and !=, >> the second two are for <, >, <=, >=. Why the inconsistency? >> >> typeck.c: error ("ISO C++ forbids comparison between pointer >> and integer"); >> typeck.c: error ("ISO C++ forbids comparison between pointer >> and integer"); >> typeck.c: pedwarn ("ISO C++ forbids comparison between >> pointer and integer"); >> typeck.c: pedwarn ("ISO C++ forbids comparison between >> pointer and integer");
These should all be pedwarns. The basic principle is to use pedwarn for things that have well-defined GNU semantics, but don't happen to be legal. That's especially true for things that are valid in GNU C. Here, the well-defined GNU semantics are that the integer is converted to the pointer type, as if by a cast. A patch to convert to pedwarns is pre-approved, if accompanied by a testcase. Thanks, -- Mark Mitchell CodeSourcery [EMAIL PROTECTED] (650) 331-3385 x713