Daniël Mantione a écrit :

James Smith a écrit :
Well, I know programmers who turn off range checking and let exceptions
fall through empty exception blocks. They don't work with me on projects.
Though it is sometimes the best way of doing. It is sometimes better
to check ranges explicitly (where it is needed to do so) rather than
to let the compiler set checks everywhere.

You almost never ship a binary with range checking, since a range check crash is for a end user generally as usefull as the protection fault that can happen when you disable range checking. The performance penalty of range checking is significant.

Range checking during development greatly reduces the change of range bugs going unnoticed into the final product. Further, for a developer, a range check error is much easier to debug than a crash later in the program because a range error caused data strutures to be overwritten.

I totally agree with you (I wrote "sometimes").

For instance, if, in a program, I made use of the following types

  TDigitFrame = array[0..0] of Longword;
  PDigitFrame = ^TDigitFrame;
  TPBigIntFrame = array[0..0] of PBigInt;
  PPBigIntFrame = ^TPBigIntFrame;
  etc.

there would not be much places where I could set {$R+} without having
to reset {$R-} almost immediately.

mm

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

Reply via email to