[fpc-pascal] overflow checking
Пётр Косаревский
ppkk at mail.ru
Fri Jun 23 12:03:57 CEST 2006
Thank you for advices!
Probably, I'll stick to global definitions.
It seems, that {$IFOPT} doesn't help conserve space when you have to switch checks somewhat often, while greatly helps write code fragments for injection.
(A line starting with {$Q-}, then simple expression, ending with some {$IFDEF ..}...{$ENDIF} sequence seems more readable to me than a company of extra lines or beginning with {$IFOPT}/{$IFDEF}: fewer symbols for eyes to make through.)
From: Vinzent Hoefler <JeLlyFish.software at gmx.net>
> Well, if you do define CHECK_OVERFLW depending on the current compiler's
> settings like this:
> {$IFOPT Q+} {$DEFINE CHECK_OVRLW} {$ENDIF}
> then ...
> > {$Q-} e:=f+g; {$IFDEF CHECK_OVRLW} {Q+} {$ENDIF}
> ... this looks like one of the easiest ways.
>
> Well, my practice is to use more lines, so that the instruction(s) in
> question don't get hidden by all the compiler-directives surrounding
> it.
From: Alexey Pavluchenko <pavluchenko at isp.kiev.ua>
> {$IFOPT Q+} {$Q-} {$DEFINE Q_SWITCHED} {$ENDIF}
> (* do some stuff here *)
> {$IFDEF Q_SWITCHED} {$Q+} {$UNDEF Q_SWITCHED} {$ENDIF}
> May not fit in one line though :)
More information about the fpc-pascal
mailing list