<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Hi Nicolas,</div><div><br>On Mar 25, 2015, at 6:14 AM, Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com">nicolas.cellier.aka.nice@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><span></span></div></blockquote><blockquote type="cite"><div><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2015-03-25 12:52 GMT+01:00 David T. Lewis <span dir="ltr"><<a href="mailto:lewis@mail.msen.com" target="_blank">lewis@mail.msen.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
On Tue, Mar 24, 2015 at 10:32:32PM -0700, Eliot Miranda wrote:<br>
<div><div class="h5">><br>
> On Tue, Mar 24, 2015 at 8:33 PM, Nicolas Cellier <<br>
> <a href="mailto:nicolas.cellier.aka.nice@gmail.com">nicolas.cellier.aka.nice@gmail.com</a>> wrote:<br>
><br>
> ><br>
> > Hi,<br>
> ><br>
> > in checkStackIntegrity, there is a comparison of char *<br>
> ><br>
> > theSP <= frameRcvrOffset<br>
> ><br>
> > Is it OK, or should we better use oop:isLessThanOrEqualTo: ?<br>
> ><br>
><br>
</div></div>> Providing that both are typed as non-void pointers to the same type this<br>
> will work. oop:isLessThanOrEqualTo: is there for comparing sqInt values<br>
> (i.e. oops) as this is a signed type and oop:isLessThanOrEqualTo: forces an<br>
> unsigned comparison.<br>
<br>
Agreed, both variables are (char *), so the pointer comparison is OK as written.<br>
<br>
Dave<br>
<br></blockquote><div><br></div><div>OK, thanks both, I see it better now.<br></div><div>It's specified in ISO/IEC 9899:TC3, 6.5.8 rule 5 (relational operators)<br>(draft available at <a href="http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf">http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf</a>)<br><br></div><div>Strictly speaking, behavior is undefined when comparing two pointers that do not point to the same aggregate or to the same array, but i guess we can live with that.<br></div></div></div></div></div></blockquote><div><br></div>yes, and here's why (IMO). <div><br></div><div>a) that comparison between two distinct aggregates is undefined is to allow exotic (object oriented) systems to implement C; we're unlikely ever to encounter such things<br><div><br></div><div>b) converting to integers is not going to magically fix undefinedness. I can't imagine an implementation that would be able to fix the undefinedness when converting to integers but wouldn't when comparing two pointers.</div><div><br></div><div>So IMO this being undefined is plain silly. It's always going to be defined. I'm sure I'm wrong, but I'd like to hear a well-reasoned rationale as to why.</div><div><br></div><div><br><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>Cheers<br><br></div><div>Nicolas<br></div></div><br></div></div>
</div></blockquote></div></div></body></html>