November 2019
Beginner to intermediate
674 pages
15h
English
The Overflow checking option regulates whether the compiler checks if certain arithmetic operations (+, -, *, Abs, Sqr, Inc, Dec, Succ, and Pred) produce a number that is too large or too small to fit into the data type. You can use compiler options, {$OVERFLOWCHECKS ON} and {$OVERFLOWCHECKS OFF} (or short forms {$Q+} and {$Q-}), to turn this option on and off in a specific part of a program.
For example, the following program will silently increment $FFFFFFFF to 0 in the first Inc statement but will raise EIntOverflow exception in the second Inc statement:
procedure TfrmCompilerOptions.btnOverflowErrorClick(Sender: TObject);var i: cardinal;begin {$Q-} i := $FFFFFFFF; // Without overflow checks, Inc will work and i will ...Read now
Unlock full access