Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 05/18/24 in Posts

  1. Erwin Mouthaan

    Exception logging/reporting on MacOS?

    Version 1.1: Added: Delphi 11 support with OSXARM64 platform https://www.smartcrashlog.com/history.html
  2. Dave Nottage

    Exception logging/reporting on MacOS?

    https://blog.grijjy.com/2021/10/18/build-your-own-error-reporter-part-3-macos-intel/ Note that when this was published, there was yet to be support for ARM, however the last line says: "I may add some missing pieces to get this to work for ARM Mac apps as well" Since the code has not been updated since then, you'd need to either contact Erik or add an issue to the repo, regarding support for ARM.
  3. I am sure this is well known but I recently discovered a new way to copy dynamic arrays: var A, B : TArray<Integer>; ... B = A; SetLength(B, Length(B)); ... Test procedure: procedure Test(); var A, B : TArray<Integer>; begin A := [1 , 2, 3]; B := A; SetLength(B, Length(B)); B[1] := 12; Assert(A[1] = 2); Assert(B[1] = 12); end; Of course Copy is simpler, but in my use case I did not want to create a copy unless it was necessary e.g. In one part of the code // create A SetLength(A, L); ... In another part of the code B = A // do stuff with B or store it as an object field If A is not recreated you save the copying operation. Not a big deal...
  4. David Heffernan

    Interesting way to copy dynamic arrays.

    Why would that be different?
  5. Anders Melander

    Interesting way to copy dynamic arrays.

    B := A makes them the same array. SetLength just makes B unique (and contains an implicit copy). I don't get what advantage assignment followed by SetLength gives you over a simple Copy. With Copy the intent is explicit.
×