> People will complain, if FPC isn't delphi compatible.

FP actually is not 100% Delphi compatible by default mode and it is not
intention to be (regarding available informations on internet) it is
actually intented to be compatible with Turbo/Borland Pascal, I suppose.
Delphi simulation mode (-Sd, or directive {$mode delphi} ) is not 100%
compatible as well.

> Delphi in this case. And I see nothing wrong with it: the compiler can't
> know the fpu exception mask at execution time when compiling the program
> so throwing an error might be as wrong as returning Inf. So the only
> real solution would be to carry out the 1/0 at run time, however, this
> leads also to inconsistent code regarding const inf = 1/0; while
> writeln(1/0); could throw an exception, writeln(Inf); wouldn't. So imo
> any possible solution is wrong in some way.

As I understood you (obviously not correct), you wrote that const block is
not checked during compiling on division by Zero (as mentioned, infinity
const can be set simply by bits setting)...

In any event, to be clear with suggestion: current solution is quiet
problematic during testing quite complex calculations functionality, where
dividing with zero constant is simple mistake. I have several quite complex
statistical applications where simple mischanged constants division by 00
instead of 100 (for example) create quite serious poblem, implying time to
find the bug. Long compilation time for checking only (with -Cr ) and then
without it just double already enormous compiling time (Lazarus project).
That issued problem was consist with Delphi, however ut since fast
compilation error was located and fixed very fast...

Perhaps new {$AllowedDivisionByZero+-}compiler directive would be an
convenient compromise.

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to