Recent

Author Topic: Typed array / Open array error.  (Read 1059 times)

segfault

  • Full Member
  • ***
  • Posts: 107
Typed array / Open array error.
« on: May 20, 2018, 11:44:14 am »
I have a typed array which I'm sending to a procedure with open array parameters declared as var, but I'm getting an error message saying call by var parameters have to match exactly. This is using lazarus for windows. The strange thing I don't get the error using fpc on Linux using a command line version of the same code. Any suggestions? Thanks.

Thaddy

  • Hero Member
  • *****
  • Posts: 14215
  • Probably until I exterminate Putin.
Re: Typed array / Open array error.
« Reply #1 on: May 20, 2018, 12:27:18 pm »
I have a typed array which I'm sending to a procedure with open array parameters declared as var,
An open array parameter is not a typed array or dynamic array. Needs to be passed a typed array if you mean a typed array. I know the syntax is confusing: they look like dynamic arrays, but they are not!
Quote
but I'm getting an error message saying call by var parameters have to match exactly. This is using lazarus for windows. The strange thing I don't get the error using fpc on Linux using a command line version of the same code. Any suggestions? Thanks.
I don't believe that. Do you have a small example? The compiler is the exact same. If you show it compiles differently -given the same settings - from IDE or command line that would be a bug. (But I can't reproduce this without code)
I already answered a question about the same problem last week, with example code.

Note that it should not be possible that there is in this case a difference between platforms... because how the compiler works....
So: example code...
« Last Edit: May 20, 2018, 12:41:41 pm by Thaddy »
Specialize a type, not a var.

 

TinyPortal © 2005-2018