On Sun, 7 Jan 2024, Adriaan van Os via fpc-pascal wrote:
Quiz.
Which of below constant declarations are accepted by the compiler and what is
their value ?
const
ki1 = + 2;
ki2 = +2;
+x is a unary expression.
ki3 = 2+;
Does not compile, the binary expression is not complete.
kr1 = 1.;
There is some special handling for 1.
(ending with a dot) due to Delphi/TP compatibility, they accept it.
kr2 = 1e-2;
kr3 = 1e+2;
kr4 = 1.e+2;
kr4: Same as kr1 in FPC, but Delphi does not accept it.
kr5 = 1 . e + 2;
Same as kr1, but not accepted by Delphi.
kr6 = 1 . 0 e + 2;
kr6 does not compile, although I don't see why if kr5 is accepted..
Delph does not accept it.
kr7 = 1.0e+2;
kr8 = 1.0 e + 2;
kr8 Does not compile, probably same reason as kr6. Delphi does not accept it.
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal