Re: [xml] A long URL causes SEGV



Igor Zlatkovic wrote:
Daniel Veillard wrote:

  The C spec itself.
  There is an awful lot of code relying on the order of such compound
test, like for example
   if ((p != NULL) && (*p != 0))
you have the right to expect that if p is NULL the dereference will not occur. It's the same for the test you pointed out, and in a lot of places in libxml2
code.


For reasons not even known to me, I have lived under assumption that the compiler might perhaps take the freedom to reorder the execution of those tests. Doing so would not affect the logic of the whole expression and the compiler just might think it would help some of its mysterious and aggressive optimisation steps. Those were my thoughts. It was never really important, somehow. Now, thinking of it, for years I made code which leaves the compiler a freedom the compiler would never take :-)


It might do such reordings - but only *IF* such would not have any user visible side effects. Such are more likely on machines that have predicated instructions, non-faulting loads and other such "goodies" for high performance.

See, I know what the compiler does. I just never knew wether the compiler must do it, or it just happen to do it.

Hm, instead of rereading some official info, I have believed another urban myth which I created for myself without ever noticing. So read the docs, folks, or you'll end up like me. :-) :-)

Thanks for the answer, all of you.

Ciao,
Igor

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]