Opened 12 years ago

Last modified 12 years ago

#1746 closed defect (fixed)

Inconsistent array access using indices — at Initial Version

Reported by: mburisch Owned by: mburisch
Priority: high Milestone: 1.9.0
Component: Code Generation Version:
Keywords: Cc: mburisch

Description

Array access inside a function seems to be 0-based, whereas I think it should be 1-based. Furthermore it depends on wheter evaluation is during compile time (1-based) or runtime (0-based). Se the following example:

{{{model Test2

function func

input Integer idx;
output Integer value;

protected

constant Integer[4] values = {1, 2, 3, 4};

algorithm

value := values[idx];

end func;

parameter Integer idx = 1;
parameter Integer p1 = func(1); = 1
parameter Integer p2 = func(idx);
= 2

end Test2;}}}

Change History (0)

Note: See TracTickets for help on using tickets.