Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: bugs, Bugs and BUGS!

Author: Filip Tvrzsky

Date: 17:11:52 05/27/04

Go up one level in this thread


On May 27, 2004 at 19:05:42, Uri Blass wrote:

>On May 27, 2004 at 18:41:59, Randall Shane wrote:
>
>>On May 27, 2004 at 18:10:47, Uri Blass wrote:
>><snippage>
>>>
>>>I do not get the same move twice when I have
>>>printf("%s ",move_str(0));
>>>printf("%s ",move_str(1));
>>>
>>>I thought that
>>>printf("%s %s ",move_str(0),move_str(1));
>>>should be exactly the same instruction.
>>>
>>>I understand now that it is not and the second printf does not print move_str(1)
>>>immediatly after it calculates it but calculates also move_str(0) and change the
>>>value of move_str(1) by doing it.
>>>
>>>I think that it is a bug in the language or in the compiler because it is clear
>>>that the programmer mean the same in both cases.
>>>
>>>
>>>correct compiler can solve the problem by translating
>>>
>>>printf("%s %s ",move_str(0),move_str(1));
>>>to
>>>printf("%s ",move_str(0));
>>>printf("%s ",move_str(1));
>>>
>>>I see no logical reason not to translate it in that way from human point of
>>>view.
>>
>>Ah, but how is the compiler supposed to know that you didn't mean to overwrite
>>the array, which is defined internal to your move_str routine?
>  Without
>>extensive and deep analysis of the routines, it can't make that assumption.
>
>
>I think it can make this assumption.
>I see no reason to write one printf of 2 strings and to mean different thing
>than the thing that is done by 2 printf.
>
>It is a confusing code.

Uri, I am sorry, but this is really YOUR fault, not compiler fault. I am also
little bit suprised at your complaints about compiler behaviour knowing your
strictly logical style of thinking. Because when you read language specification
and think thoroughly about it then you should realize that compiler does exactly
what is supposed to do and not what it could assume to be your wish. And thank
God for it! Because I am sick of software which knows better than me what I
want.
Filip

>The compiler should at least warn me if the meaning of one printf can be
>different than the meaning of 2 printf in that case.
>
>>Even then, how is it supposed to know that you really wanted two separate
>>strings?  Maybe you wanted the behavior you got -- it can't know that.
>
>If I want that behaviour then I should use different code and not use code when
>2 printf have a different meaning than 1 printf.
>
>Uri



This page took 0.01 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.