On Sun, 5 Nov 2023, Bo Berglund via fpc-pascal wrote:
You must copy the data. The copy() function can be used for this.
Follow-up question:
Can I change the function declaration like this and preserve the content?
function TSSConnection.ParseCmdFileData(var SSCmdFile: TSSCommandFile; const
Buf: TBytes): boolean;
This does not preserve the content. The "const" means you cannot change the
pointer, so
Buf:=a;
will fail
But
Buf[0]:=1;
will still compile.
Or must I copy the argument Buf inside the function to a local BufL version?
That is what you adviced, right?
Yes.
Mcihael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal