Recent

Author Topic: I need clarification with "open Arrays"  (Read 716 times)

Thaddy

  • Hero Member
  • *****
  • Posts: 8679
Re: I need clarification with "open Arrays"
« Reply #15 on: August 18, 2019, 06:09:23 pm »
Can you give an example of a "typed dynamic array declared as const" whose elements can be modified ?.  I doubt the compiler is going to allow modifying the elements of an array that has been declared as const parameter to some function/procedure.
I actually just did! You are really useless today, aren't you? :) O:-) https://forum.lazarus.freepascal.org/index.php/topic,46444.msg330997.html#msg330997

See that I modify a value to 100. It also can be retrieved outside .
See also that you can not do that with the commented code in the first overload.

Here it just means you can not modify the size, but you can modify the individual content of the elements. (Delphi compatible) There are no copy semantics there.
« Last Edit: August 18, 2019, 06:16:19 pm by Thaddy »
Most people that want to use threading should learn to patch their jeans first: use a needle.

440bx

  • Hero Member
  • *****
  • Posts: 1086
Re: I need clarification with "open Arrays"
« Reply #16 on: August 19, 2019, 01:10:23 am »
I actually just did! You are really useless today, aren't you? :) O:-)
That thing you call an "example" doesn't even compile therefore it is like you, eternally useless.

But, knowing you, I should have specified you provide a _working_ example. 
using FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

PascalDragon

  • Hero Member
  • *****
  • Posts: 571
  • Compiler Developer
Re: I need clarification with "open Arrays"
« Reply #17 on: August 19, 2019, 09:30:08 am »
I actually just did! You are really useless today, aren't you? :) O:-)
That thing you call an "example" doesn't even compile therefore it is like you, eternally useless.
It requires FPC 3.2 or newer, because of the initialization of a and b.

440bx

  • Hero Member
  • *****
  • Posts: 1086
Re: I need clarification with "open Arrays"
« Reply #18 on: August 19, 2019, 09:39:47 am »
It requires FPC 3.2 or newer, because of the initialization of a and b.
Thank you for that information.

On the subject of FPC 3.2, any idea as to when it might be released ?
« Last Edit: August 19, 2019, 09:42:23 am by 440bx »
using FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

PascalDragon

  • Hero Member
  • *****
  • Posts: 571
  • Compiler Developer
Re: I need clarification with "open Arrays"
« Reply #19 on: August 19, 2019, 09:46:23 am »
Hopefully this year...  :-[