Forum > FPC development

KYLIX LOOP VS FPC LOOP [SEVERE BUG?!]

<< < (2/2)

Snify:
Thank you for the helpful information.
I used a very empty Kylix Project with different build modes and they all seem to behave like this (for now).

Better is, to just avoid the counter vars outside the loop.

Altough undefined is odd, if you see exactly the last value plus 1...
I'd except some other random value(s)

Kays:

--- Quote from: Snify on October 18, 2021, 03:00:10 pm ---Kylix shows a value of 7 whereas FPC shows a value of 6 - at the end of the loop!
--- End quote ---
Tell that the Kylix-people. It’s a “severe bug” in Kylix. A glance at ISO 7185 tells us
--- Quote ---
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---for v := e1 to e2 do bodyshall be equivalent to

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---begin        temp1 := e1;        temp2 := e2;        if temp1 <= temp2 then        begin                v := temp1;                body;                while v <> temp2 do                begin                        v := succ(v);                        body                end        endend
--- End quote ---
Note
--- Quote ---After a for-statement is executed, other than being left by a goto-statement, the control-variable shall be undefined.
--- End quote ---
You (as a programmer) aren’t supposed to presume your control-variable has any particular value. In other words, you shouldn’t be “outraged” that FPC terminates with 6 and Kylix with 7.

“It’s not a bug, it’s a feature.” FPC has the “feature” that after a for-loop the control-variable holds the finalValue.

MarkMLl:

--- Quote from: Kays on October 18, 2021, 05:21:21 pm ---
--- Quote ---After a for-statement is executed, other than being left by a goto-statement, the control-variable shall be undefined.
--- End quote ---

--- End quote ---

And I believe that's always been the case, i.e. it wasn't just a "tightening up" introduced by the ISO standard.

MarkMLl

Navigation

[0] Message Index

[*] Previous page

Go to full version