Re: [fpc-devel] "Ordinal expression expected" awkwardness

2023-07-20 Thread Bart via fpc-devel
On Thu, Jul 20, 2023 at 7:59 AM Sven Barth via fpc-devel wrote: > It is indeed by design that not every integer type is a suitable index > variable for a for-loop. In this case that a 64-bit variable can't be used on > a platform with less than 64-bit width. The same is probably also true for

[fpc-devel] Maybe room for better documentation? open array as var param

2023-07-20 Thread Martin Frb via fpc-devel
For const param, it is well documented that the value (that includes the variable that is passed) must not be changed. But for "var param"? Well maybe, but not explicit https://www.freepascal.org/docs-html/ref/refsu68.html#x184-20800014.4.5 >> Open parameters can be passed by value, by referenc

Re: [fpc-devel] Maybe room for better documentation? open array as var param

2023-07-20 Thread Michael Van Canneyt via fpc-devel
On Thu, 20 Jul 2023, Martin Frb via fpc-devel wrote: For const param, it is well documented that the value (that includes the variable that is passed) must not be changed. But for "var param"? Well maybe, but not explicit https://www.freepascal.org/docs-html/ref/refsu68.html#x184-20800014.4

Re: [fpc-devel] Maybe room for better documentation? open array as var param

2023-07-20 Thread Martin Frb via fpc-devel
On 20/07/2023 19:24, Michael Van Canneyt via fpc-devel wrote: It's IMO probably better to outright forbid passing open array by reference. printing length(a) after x:=Nil; gives 10, which is simply wrong. The open array is not the same as the dyn array. It is at any point just a slice of

Re: [fpc-devel] Maybe room for better documentation? open array as var param

2023-07-20 Thread Sven Barth via fpc-devel
Michael Van Canneyt via fpc-devel schrieb am Do., 20. Juli 2023, 19:24: > > > On Thu, 20 Jul 2023, Martin Frb via fpc-devel wrote: > > > For const param, it is well documented that the value (that includes the > > variable that is passed) must not be changed. > > > > But for "var param"? > > > >

Re: [fpc-devel] Maybe room for better documentation? open array as var param

2023-07-20 Thread Michael Van Canneyt via fpc-devel
On Thu, 20 Jul 2023, Sven Barth via fpc-devel wrote: It's IMO probably better to outright forbid passing open array by reference. There are valid use cases for that. E.g. multiply a slice of a dynamic array by two or whatever. And forbidding var would solve nothing, see below. printing