Re: [fpc-pascal] Using constants in constant record definition

2019-06-15 Thread Simon Ameis
Am 13.06.2019 um 09:34 schrieb Dejan Boras: > It's not a bug. There's no support in FPC/Pascal for using constants > with a defined type in other declarations. > Define your MYINTEGERCONST without a type, and it should work. Thanks all. It was a bit late and while working with existent code, I did

Re: [fpc-pascal] Using constants in constant record definition

2019-06-13 Thread Dejan Boras
It's not a bug. There's no support in FPC/Pascal for using constants with a defined type in other declarations. Define your MYINTEGERCONST without a type, and it should work. const MYINTEGERCONST = 5; On Wed, Jun 12, 2019 at 10:30 PM Simon Ameis wrote: > Hello, > > I'm just porting some C cod

Re: [fpc-pascal] Using constants in constant record definition

2019-06-12 Thread Bart
On Wed, Jun 12, 2019 at 10:30 PM Simon Ameis wrote: > MYINTEGERCONST: Integer = 5;//< defining integer const It's a writeable constant, so not a constant consta if you get my drift. Declaring it just as MyIntegerConst = 5; might work just fine. I'm too lazy to chek that for you. --

Re: [fpc-pascal] Using constants in constant record definition

2019-06-12 Thread gabor
Hello Typed constants work just like initialized variables. Maybethis is the problem? Try: MYINTEGERCONST = 5; or MYINTEGERCONST = Integer(5); Regards, Michał. W dniu 2019-06-12 o 22:25, Simon Ameis pisze: Hello, I'm just porting some C code to pascal. This code contains constant structure

Re: [fpc-pascal] Using constants in constant record definition

2019-06-12 Thread Jonas Maebe
On 12/06/2019 22:25, Simon Ameis wrote: const   MYRECORDCONST2: TMyRecord = (x: 5); //< compiles fine   MYINTEGERCONST: Integer = 5;    //< defining integer const   MYRECORDCONST1: TMyRecord = (x: MYINTEGERCONST); //< using constant is no possible For historical reasons, "MYINTEGERCONST

Re: [fpc-pascal] Using constants in constant record definition

2019-06-12 Thread Marco van de Voort
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 shoul

[fpc-pascal] Using constants in constant record definition

2019-06-12 Thread Simon Ameis
Hello, I'm just porting some C code to pascal. This code contains constant structure definitions which use other constants of simple types. However FPC reports "Error: Illegal expression" when using a constant within an constant record definition. program Project1; type   TMyRecord = record