Hi,

  I have a use-case where I needed to forward declare some records.
The FPC documentation <https://www.freepascal.org/docs-html/ref/refse16.html> says "Note that a forward type declaration is only possible with pointer types and classes, not with other types".

  I wonder why? Is there any technical difference between classes and records for the purpose of forward declaration?

My use-case was to define a few records like the following:

type
  TData = record
    ....
    function ToA: TA;
   end;

  TA = record
     Data: TData;
     ....
  end;

I know I can define classes instead of record, but I do not want to do so, since I need to "Free" the objects.

Amir
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to