On Tue, Nov 24, 2015 at 4:12 AM, Mikhail T. <mi+t...@aldan.algebra.com> wrote:
> On 23.11.2015 19:43, Yann Ylavic wrote:
>
>> That's expected (or at least no cared about in this test case). We simply
>> want res to not be optimized out, so print it before leaving, without any
>> particular relevance for its value (string.h and optimized versions should
>> return the same res with the same args, ascii strings only, though).
>
> Yes, we do want the value printed -- such as to catch the kind of errors I
> reported earlier. But my question was, why does the value change depending
> on the number of iterations?

Hmm, res is not reset (to 0) in each loop, so I first thought it might
well end up having a different value when ORed more times, but that
makes no sense...

Actually the "evil" is in (S1[0])++, (S2[0])++ in the for loop, which
kills some compiler optimizations in main() but also the comparison
once we leave alpha characters range for those :)
Let's say that for this test to be relevant, the first char of S1 and
S2 must be the same (including case) ;)

Regards,
Yann.

Reply via email to