-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
I have a piece of code that crashes as soon as a function gets called. It is dependent on the size of the data and also on how the data is passed into the code.
const WIDTH = 640
const HEIGHT = 327
type
TField = tuple [
a: float,
b: float,
c: float,
d: float,
e: float]
TRow = array[0..WIDTH - 1, TField]
TGrid = array[0..HEIGHT -1, TRow]
TWorld = tuple [grid: TGrid]
proc display(world: TWorld) =
for r, row in world.grid:
for c, field in row:
echo("init " & $(r) & " " & $(c))
var w: TWorld
w.display()If you modify WIDTH to be one less, the code works. The crash seems to be as soon as the display proc is reached; the display proc isn't even executed. If you add another tuple field to TField the code fails even with HEIGHT 327.
If you modify display to get TGrid as a parameter directly and call display on it, it seems to work for arbitrary HEIGHTs.
Metadata
Metadata
Assignees
Labels
No labels