[Freeciv-Dev] Re: (PR#10336) citymap cleanup
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10336 >
Gregory Berkolaiko wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=10336 >
>
> On Sat, 25 Sep 2004, Jason Short wrote:
>
>
>><URL: http://rt.freeciv.org/Ticket/Display.html?id=10336 >
>>
>>>> - citymap[x1][y1] = citymap[x1][y1]++;
>>>> + CITYMAP(x1, y1)++;
>>It's also possible that the two lines of code give the same results. Is
>>the ++ evaluated after the = or before it? I have no idea.
>
>
> funnily, in either case it would produce the same result as
> citymap[x][y]++
x++ gives the original value of x not the new value. So if the = is
done after the ++ then the code is perhaps equivlant to
tmp = citymap
citymap++
citymap = tmp
...or so I imagine. However this seems unlikely, both because the code
works the way it is now and because it seems illogical to "insert" the =
in between the two parts of the ++ in this way.
jason
|
|