Pointers in comparison expressions
Vincent Lefevre
vincent+gcc@vinc17.org
Sat Jul 16 11:49:00 GMT 2005
On 2005-07-12 23:42:23 +0200, Erik Trulsson wrote:
> Pointer subtraction is only well defined if both pointers point to
> elements in the same array (or one past the end of the array).
I don't know what you mean by "well defined", but even in this case,
the behavior can be undefined. So, replacing a < b by a - b < 0 is not
guaranteed to work with every implementation, just like with integers.
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
More information about the Gcc
mailing list