On Fri, 23 Jul 2010 05:48:39 +0300, Andrew W. Nosenko wrote:

> On Fri, Jul 23, 2010 at 03:34, Dan Sommers <[email protected]>
> wrote:

>> There's no need for two counters.  Just use the same counter inside
>> both loops and check for that counter being zero (or non-zero) at the
>> end (then again, a sufficiently clever optimizer may already be doing
>> that for you).

> No, optimizer cannot to do that because they aren't equivalent.  Just
> imagine that one int (e.g. digits_before) obtained value 1 and another
> overflowed to -1.  This scenario will produce "true" in
> digits_before+digits_after==0 check.  Now imagine the only one counter. 
> On the same imaginable data it will be overflowed to -2 and check for
> zero will return "false".

Duh.  I knew that.  ;-)

> But anyway, I see no needs in counters at all.  Just because what you
> need is just an boolean flag (zero vs. not zero, there were any digits
> or not) ...

Agreed.

> By the way it far simpler for optimizer and may be handled better by it
> indeed without unsafe tricks and assumptions.

Premature optimization and all that.  Sorry.

So what's the next step?  Does someone submit a bug report, or a bug 
report with a suggested patch, or something else?

Dan

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

Reply via email to