[fpc-pascal] Managed record types

Thomas Kurz fpc.2021 at t-net.ruhr
Sat Nov 2 18:46:13 CET 2024


Hello,

when I make a record type managed by adding an `Initialize` operator according to [1], can I rely on the record being initialized at the beginning of a function in which the record is the function result?

Example:

type TRec = record
  // whatsoever
  class operator Initialize(var aRec: TRec);
end;

function DoSomething: TRec;
begin
  // <---- can I assume that `Result` is initialized when the function is entered?
  // more code
end;

[1] https://wiki.freepascal.org/management_operators



More information about the fpc-pascal mailing list