From 5d49b946adba85bb2075b0b96a4de5f66718d41f Mon Sep 17 00:00:00 2001 From: oscarl-2 Date: Thu, 20 Nov 2003 10:27:03 +0000 Subject: [PATCH] initial checkin --- .../source/bepascal/test/CompilerModes.pas | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 bepascal/source/bepascal/test/CompilerModes.pas diff --git a/bepascal/source/bepascal/test/CompilerModes.pas b/bepascal/source/bepascal/test/CompilerModes.pas new file mode 100644 index 0000000..3bf81d3 --- /dev/null +++ b/bepascal/source/bepascal/test/CompilerModes.pas @@ -0,0 +1,41 @@ +(* + This unit shows a difference between FPC's compiler modes. + In the mode objfpc (-S2) this units doesn't compile, the error message is: + "Duplicate identifier Preset." + If we use Delphi mode (-Sd) it compiles without any errors. + + From FPC developers: "we made that desicion so you write less bogus code." + + This means, fpc modes are stricter on the sintaxis than Delphi is. + Nothing on FPC docs indicates this difference. According to one of the FPC + developers, they will add this to the documentation. + + To avoid this: either use other names for parameters, or use: + {$mode Delphi} + +*) + +unit CompilerModes; + +{.$mode Delphi} // <<-- remove the dot to compile + +interface + +type + TAClass = class + private + fPreset : Boolean; + public + procedure SetPreset(Preset : Boolean); + property Preset : Boolean read fPreset write SetPreset; + end; + +implementation + +procedure TAClass.SetPreset(Preset : Boolean); +begin + if Preset = fPreset then Exit; + fPreset := Preset; +end; + +end. \ No newline at end of file