Recent

Author Topic: Using the record type inside a self-declaration  (Read 3872 times)

440bx

  • Hero Member
  • *****
  • Posts: 6463
Re: Using the record type inside a self-declaration
« Reply #15 on: July 04, 2024, 11:04:55 am »
At least from D7 onwards the compilers throw errors, as does fpc.
Delphi 2 throws an error as well.
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 19125
  • Glad to be alive.
Re: Using the record type inside a self-declaration
« Reply #16 on: July 04, 2024, 06:18:09 pm »
Thanks for testing. 8-)
objects are fine constructs. You can even initialize them with constructors.

440bx

  • Hero Member
  • *****
  • Posts: 6463
Re: Using the record type inside a self-declaration
« Reply #17 on: July 04, 2024, 09:23:46 pm »
Thanks for testing. 8-)
You're welcome.
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

PascalDragon

  • Hero Member
  • *****
  • Posts: 6387
  • Compiler Developer
Re: Using the record type inside a self-declaration
« Reply #18 on: July 04, 2024, 09:36:01 pm »
I didn't even know it was possible. From which version?
Code: Pascal  [Select][+][-]
  1. type
  2.   TRec = record
  3.     FRecs: array of TRec;
  4.     FOther: Integer;
  5.   end;

That works because it is essentially the same as

Code: Pascal  [Select][+][-]
  1. type
  2.   PRec = ^TRec;
  3.   TRec = record
  4.     FRecs: PRec;
  5.     FOther: Integer;
  6.   end;

 

TinyPortal © 2005-2018