[Lazarus] Wrong Duplicate Identifier error message?

Special special at joepgen.com
Thu Jul 2 08:38:00 CEST 2020


Am 01.07.2020 um 20:36 schrieb Mattias Gaertner via lazarus:
> On Wed, 1 Jul 2020 20:15:45 +0200
> Special via lazarus <lazarus at lists.lazarus-ide.org> wrote:
>
>> [...]
>> the following unit throws an (I think wrong) compile error "Duplicate
>> identifier 'Connection'". This happens Lazarus with 2.0.8 under Win
>> 10 (64). According to Nicklaus Wirth and Kathleen Jensen ('Pascal
>> User Manual and Report') there is no duplicate  identifier in this
>> unit, since 'Connection' in procedure Proc ist strictly local and
>> does not interfere with Identfiers outside this procedure.
> You are aware, that this manual was way before Object Pascal?
>
>   
>> Code:
>>
>> unit DoubleDefinition;
>> {$mode objfpc}{$H+}
> $mode objfpc is more strict on duplicates.
> FPC supports other modes like $mode Delphi, which allows this
> duplicate.
>
> Mattias

Here there is no Duplicate Identifier error message:

program Duplicate;
{$mode objfpc}{$H+}

var TestVar: string;

procedure Proc;
var TestVar: string;
begin
   TestVar:= 'zwei';
   writeln (TestVar)
end;

begin
   TestVar:= 'eins';
   writeln (TestVar);
   Proc
end.

Why this inconsistency?

Regards --  Joe



More information about the lazarus mailing list