Opened 12 years ago
Last modified 12 years ago
#1746 closed defect (fixed)
Inconsistent array access using indices
Reported by: | mburisch | Owned by: | mburisch |
---|---|---|---|
Priority: | high | Milestone: | 1.9.0 |
Component: | Code Generation | Version: | |
Keywords: | Cc: | mburisch |
Description (last modified by sjoelund.se)
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 (2)
comment:1 Changed 12 years ago by sjoelund.se
comment:2 Changed 12 years ago by sjoelund.se
- Cc changed from mburisch, to mburisch
- Component set to Code Generation
- Description modified (diff)
- Milestone set to 1.9.0
Note: See
TracTickets for help on using
tickets.
Thanks for the report. Fixed in r11922.