[fpc-pascal] Default record const values
Benjamin Rosseaux
benjamin at rosseaux.com
Wed Nov 28 21:34:47 CET 2018
I'm using this solution myself for the vector and matrix data types at
https://github.com/BeRo1985/pasvulkan/blob/master/src/PasVulkan.Math.pas
https://github.com/BeRo1985/pasvulkan/blob/master/src/PasVulkan.Math.TpvVector2.Swizzle.Definitions.inc
https://github.com/BeRo1985/pasvulkan/blob/master/src/PasVulkan.Math.TpvVector2.Swizzle.Implementations.inc
https://github.com/BeRo1985/pasvulkan/blob/master/src/PasVulkan.Math.TpvVector2Helper.Swizzle.Definitions.inc
https://github.com/BeRo1985/pasvulkan/blob/master/src/PasVulkan.Math.TpvVector2Helper.Swizzle.Implementations.inc
https://github.com/BeRo1985/pasvulkan/blob/master/src/PasVulkan.Math.TpvVector3.Swizzle.Definitions.inc
https://github.com/BeRo1985/pasvulkan/blob/master/src/PasVulkan.Math.TpvVector3.Swizzle.Implementations.inc
https://github.com/BeRo1985/pasvulkan/blob/master/src/PasVulkan.Math.TpvVector3Helper.Swizzle.Definitions.inc
https://github.com/BeRo1985/pasvulkan/blob/master/src/PasVulkan.Math.TpvVector3Helper.Swizzle.Implementations.inc
https://github.com/BeRo1985/pasvulkan/blob/master/src/PasVulkan.Math.TpvVector4.Swizzle.Definitions.inc
https://github.com/BeRo1985/pasvulkan/blob/master/src/PasVulkan.Math.TpvVector4.Swizzle.Implementations.inc
https://github.com/BeRo1985/pasvulkan/blob/master/src/PasVulkan.Math.TpvVector4Helper.Swizzle.Definitions.inc
https://github.com/BeRo1985/pasvulkan/blob/master/src/PasVulkan.Math.TpvVector4Helper.Swizzle.Implementations.inc
without any bigger issues, except that the Delphi IDE has some runtime
CodeInsight record lookup issues from time to time.
On Wed, Nov 28, 2018 at 8:47 PM Sven Barth via fpc-pascal <
fpc-pascal at lists.freepascal.org> wrote:
> 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
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20181128/667489bc/attachment.html>
More information about the fpc-pascal
mailing list