[fpc-devel] Multiple type sections - Far forward type declarations [feasible feature request?]

Sandro Cumerlato sandro.cumerlato at gmail.com
Mon Oct 30 21:55:43 CET 2017


Hello,
please take a look at this small example:

----------------------------------------------
program types;

type
  PMyTypeA = ^MyTypeA;
  PMyTypeB = ^MyTypeB;

type
  MyTypeA = record
    foo: integer;
    bar: integer;
  end;

type
  MyTypeB = record
    foo: string;
    bar: string;
  end;

begin
end.
----------------------------------------------

it obviously doesn't compile because there are multple "type" sections
defined and forward types are not properly resolved within the same "type"
section, reference: https://www.freepascal.org/docs-html/ref/refse16.html

Considering that I often encounter difficulties translating C headers to
Pascal because declared types are most of the time dislocated in the header
source file and splitted in different blocks, I'd like to know if there is
a switch to enable forward type resolution within the same source file at
least, and if not please let me know if it can be considered a feasible
feature request.

Thank You in advance.

Sandro Cumerlato
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20171030/ae33e6b0/attachment.html>


More information about the fpc-devel mailing list