[fpc-pascal] Record operator for assignment

LacaK lacak at zoznam.sk
Fri Apr 28 07:21:31 CEST 2017


> Instead of making constructors and doing busy work It would be nice if Free Pascal could let you assign records outside of type blocks like:
>
> rec := (x: 0; y: 0; z: 0);
you can workaround this by using typed constant for instance. Something 
like:

const
   DEFAULT_REC: TMyRec = (x: 0; y: 0; z: 0 );
var
   rec: TMyRec;
begin
   rec := DEFAULT_REC; // or rec := Default(TMyRec) if you want zeroes
   ...

L.




More information about the fpc-pascal mailing list