[fpc-pascal] Default record const values

Sven Barth pascaldragon at googlemail.com
Wed Nov 28 20:46:51 CET 2018


Am 28.11.2018 um 20:27 schrieb Benjamin Rosseaux:
> program Test123;
> {$ifdef fpc}
>   {$mode delphi}
> {$endif}
>
> type
>   TTest = record
>   public
>     a: LongInt;
>     b: LongInt;
>   end;
>
>   TTestHelper = record helper for TTest
>   public
>     const Default: TTest = (a: 1; b: 2);
>   end;
>
> var
>   Test: TTest;
> begin
>   Test := TTest.Default;
> end.
>
That is indeed a good idea and with the extension to allow multiple 
helpers there wouldn't even be a negative impact... 🤔

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20181128/382e9b8d/attachment.html>


More information about the fpc-pascal mailing list