[fpc-pascal] Local compiler options
Jonas Maebe
jonas.maebe at elis.ugent.be
Wed Dec 5 11:19:24 CET 2007
On 05 Dec 2007, at 10:23, Adriaan van Os wrote:
> I didn't find an equivalent for FPC in delphi or objfpc mode. All I
> can think of is
>
> {$ifopt R+}
> {$define local_RangeCheck}
> {$endif}
> {$R-}
> i:= longword( -1)
> {$ifdef local_RangeCheck}
> {R+}
> {$endif}
That's indeed the classic way to do it in TP/FPC/Delphi. I'm not
aware of any other way.
> This is a bit ugly and not fully reliable, e.g. try
>
> {$mode objfpc}
> program TestLocal;
> var i: longint;
> begin
> {$R+}
> {$ifopt R+}
> {$define local_RangeCheck}
> {$R-}
> {$endif}
> i:= longword( -1);
> {$ifdef local_RangeCheck}
> {$R+}
> {$endif}
> end.
That's a bug in the scanner, please submit a bug report.
Jonas
More information about the fpc-pascal
mailing list