Sign in Join

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

Mailing lists / fpc-devel / 2003-11

Bug or missing documentation?

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

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

BiPolar

Hello.

The code below gives: "foo.pas(13,33) Error: Duplicate identifier NAME" when compiled with -S2. It compiles ok with -Sd though. The thing is, I coudn't find any reference to this difference of behavior under the "Compiler Modes" section of FPC docs, neither in other sections.
Is this a bug, or I missed something in the docs?

Thanks for your time and work.

Oscar Lesta. (not on the mail list, please CC any reply)

(using FPC 1.0.8-pre1 for BeOS)
---------------------------------------------------------------------- unit foo;

interface
type
  TBaseClass = class
  public
    aName : string;
  end;
  TChildClass = class(TBaseClass)
  public
    procedure Test(aName : string);
  end;
implementation
procedure TChildClass.Test(aName : string);
begin
// do nothing.
end;
end.
----------------------------------------------------------------------

Reply by email

Peter Vreman
to BiPolar
Show quoted text 10 lines
Hello. The code below gives: "foo.pas(13,33) Error: Duplicate identifier NAME" when compiled with -S2. It compiles ok with -Sd though. The thing is, I coudn't find any reference to this difference of behavior under the "Compiler Modes" section of FPC docs, neither in other sections. Is this a bug, or I missed something in the docs? Thanks for your time and work.

It is a decision that we made for fpc mode to force you to write code that is less buggy. Because using name in the method it is not clear from the source which name you want to use unless you know that the compiler prefers locals over object fields.

You need to decide for yourself: Use the stricter fpc mode or the delphi mode. For delphi mode the reference is the syntax of delphi. We try to follow it as close as possible.

Reporting issues that work in delphi mode and not in objfpc mode will almost always be rejected. We made the decision for those. And when you don't like objfpc mode then just continue to use delphi mode, we don't force you to use objfpc mode.

Reply by email

BiPolar
to Peter Vreman
Show quoted text 19 lines
> The code below gives: "foo.pas(13,33) Error: Duplicate identifier > NAME" > when compiled with -S2. It compiles ok with -Sd though. > [...] > Is this a bug, or I missed something in the docs? It is a decision that we made for fpc mode to force you to write code that is less buggy. Because using name in the method it is not clear from the source which name you want to use unless you know that the compiler prefers locals over object fields. [...] Reporting issues that work in delphi mode and not in objfpc mode will almost always be rejected. We made the decision for those. And when you don't like objfpc mode then just continue to use delphi mode, we don't force you to use objfpc mode.

Perfectly clear, now that you explained that difference. The thing is, as the "Compiler Modes" section of FPC docs doesn't mention these facts /differences, it may lead to users of FPC to think that there may be a bug (as I did).

Thanks for replying, and many thanks for your work on FPC.

Oscar Lesta.

Reply by email

Unknown author
to BiPolar
BiPolar wrote 24 lines
> > The code below gives: "foo.pas(13,33) Error: Duplicate identifier > > NAME" > > when compiled with -S2. It compiles ok with -Sd though. > > [...] > > Is this a bug, or I missed something in the docs? > > It is a decision that we made for fpc mode to force you to write code > that > is less buggy. Because using name in the method it is not clear from > the > source which name you want to use unless you know that the compiler > prefers locals over object fields. > [...] > Reporting issues that work in delphi mode and not in objfpc mode will > almost always be rejected. We made the decision for those. And when > you > don't like objfpc mode then just continue to use delphi mode, we > don't > force you to use objfpc mode. Perfectly clear, now that you explained that difference. The thing is, as the "Compiler Modes" section of FPC docs doesn't mention these facts /differences, it may lead to users of FPC to think that there may be a bug (as I did).

Added to the todo list.

Michael.

Show quoted text 9 lines
Thanks for replying, and many thanks for your work on FPC. Oscar Lesta. _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email