I attempted to use a typed constant:
const
tprob : Double = 0.020;But the compiler (3.2.2) balked as illegal expression. Am i misreading section "2.2 Typed constants” in the reference manual?
Thanks,
Pete

Mailing lists / fpc-pascal / 2026-01
4 messages · 2 people ·
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
I attempted to use a typed constant:
const
tprob : Double = 0.020;But the compiler (3.2.2) balked as illegal expression. Am i misreading section "2.2 Typed constants” in the reference manual?
Thanks,
Pete
Ok I should have read the error message, the problem is with the following declaration, not the first:
const
tprob: double = 0.020000000;
lprob: double = tprob/1e4;If I remove the types then it compiles, with the types it says "Error: Illegal expression” on the second declaration.
P Padil wroteOk I should have read the error message, the problem is with the following declaration, not the first: const tprob: double = 0.020000000; lprob: double = tprob/1e4;
For legacy reasons these actually declare variables.
Maybe you want
const
tprob = double(0.02);
lprob = double(tprob/1e4);Mattias
Ah ok, thanks.