Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2014-08

Is this normal or bug ?

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

FreeMan
   Tmy_Form = class(TForm)
   private
     { private declarations }
      v1:integer;
      v2:string;
   public
     { public declarations }
     function exmple(v1:integer;v2:string):boolean;
   end;

when compile:

xx.pas(8,21) Error: Duplicate identifier "v1"
xx.pas(8,32) Error: Duplicate identifier "v2"

first definition main class's variable, compiler error in function parameter "Duplicate identifier" is it normal or bug?

Reply by email

Howard Page-Clark
to FreeMan
FreeMan wrote 17 lines
Tmy_Form = class(TForm) private { private declarations } v1:integer; v2:string; public { public declarations } function exmple(v1:integer;v2:string):boolean; end; when compile: xx.pas(8,21) Error: Duplicate identifier "v1" xx.pas(8,32) Error: Duplicate identifier "v2" first definition main class's variable, compiler error in function parameter "Duplicate identifier" is it normal or bug?

It is a feature of {$mode objfpc}, not a bug.
If you don't like the feature, use {$mode delphi} which allows such duplicate identifiers (and some other Delphi sloppiness).

Reply by email