[fpc-pascal] Declaring an array as var or not in function calls?

2023-04-12 Thread Bo Berglund via fpc-pascal
I am wondering how to deal with this var or not in function calls: In a processing program where I am building the command arguments for a write operation by analyzing incoming commands and splitting the data such that the write can be fully done by executing a series of smaller write commands

Re: [fpc-pascal] Declaring an array as var or not in function calls?

2023-04-12 Thread Bo Berglund via fpc-pascal
On Thu, 13 Apr 2023 00:06:16 +0200, Sven Barth via fpc-pascal wrote: >Bo Berglund via fpc-pascal schrieb am >Mi., 12. Apr. 2023, 21:17: > >> Now my question: >> >> Since I am modifying the WArgs variable inside the BuildArgumentsArray >> function and using its new content

Re: [fpc-pascal] Declaring an array as var or not in function calls?

2023-04-12 Thread Giuliano Colla via fpc-pascal
Il 12/04/2023 21:17, Bo Berglund via fpc-pascal ha scritto: And if so, what is the rule for*when* to use var in function call argument lists for items that will be changed inside the called function and used afterwards? Your Wargs is defined as an open array, i.e. its length is unknown at

Re: [fpc-pascal] Declaring an array as var or not in function calls?

2023-04-12 Thread Sven Barth via fpc-pascal
Bo Berglund via fpc-pascal schrieb am Mi., 12. Apr. 2023, 21:17: > Now my question: > > Since I am modifying the WArgs variable inside the BuildArgumentsArray > function > and using its new content afterwards in the WriteItem function I assumed > that I > had to use var as shown

Re: [fpc-pascal] Declaring an array as var or not in function calls?

2023-04-12 Thread Sven Barth via fpc-pascal
Giuliano Colla via fpc-pascal schrieb am Mi., 12. Apr. 2023, 22:54: > Il 12/04/2023 21:17, Bo Berglund via fpc-pascal ha scritto: > > And if so, what is the rule for **when** to use var in function call argument > lists for items that will be changed inside the called function and used >