[fpc-pascal] Using constants in constant record definition

Marco van de Voort fpc at pascalprogramming.org
Wed Jun 12 22:39:32 CEST 2019


Op 2019-06-12 om 22:25 schreef Simon Ameis:
> const
>    MYRECORDCONST2: TMyRecord = (x: 5); //< compiles fine
>    MYINTEGERCONST: Integer = 5;        //< defining integer const
>    MYRECORDCONST1: TMyRecord = (x: MYINTEGERCONST); //< using constant is
> no possible
> begin
> end.
>
> Is this intended or should I fill in a bug report? If it's intendet, I'm
> wondering why?

myintegerconst is a typed initialized variable depending on the $J state.

Use

   MYINTEGERCONST = Integer ( 5);

to define a true integer const. True consts don't occupy memory.



More information about the fpc-pascal mailing list