Sign in Join

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

Mailing lists / fpc-devel / 2008-05

TRegistry, TRegIniFile

10 messages · 5 people ·

Reply by email Subscribe to this list Your subscription

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

Paul Ishenin

Hello, FPC developers' list.

Why

TRegistry = class(TObject)
...
public
   constructor Create; overload;
   constructor Create(aaccess:longword); // <<-- no overload
...
TRegIniFile = class(TRegistry)
...
public
   constructor Create(const FN: string);  // <<-- no overload
   constructor Create(const FN: string;aaccess:longword); overload;
...

Is this by design that 2 constructors miss "overload" keyword in the declaration? Delphi has overload everywhere.

I suppose this cause this code to fail with message:

[code]
var
   fReg: TRegIniFile;
begin
   fReg := TRegIniFile.Create;
end;
[/code]

[message]
Error: Incompatible types: got "constructor TRegIniFile.Create(const AnsiString)" expected "TRegIniFile"
[/message]

Is it possible to correct if it is not by design in both trunk and fixes_2_2?

Best regards, Paul Ishenin.

Reply by email

Vincent Snijders
to Paul Ishenin
Paul Ishenin wrote 20 lines
Hello, FPC developers' list. Why TRegistry = class(TObject) ... public constructor Create; overload; constructor Create(aaccess:longword); // <<-- no overload ... TRegIniFile = class(TRegistry) ... public constructor Create(const FN: string); // <<-- no overload constructor Create(const FN: string;aaccess:longword); overload; ... Is this by design that 2 constructors miss "overload" keyword in the declaration? Delphi has overload everywhere.

I guess overload can be removed.

Show quoted text 16 lines
I suppose this cause this code to fail with message: [code] var fReg: TRegIniFile; begin fReg := TRegIniFile.Create; end; [/code] [message] Error: Incompatible types: got "constructor TRegIniFile.Create(const AnsiString)" expected "TRegIniFile" [/message]

I don't think it will fail. Overload is not required in mode objfpc as it is in Delphi.

Vincent

Reply by email

Paul Ishenin
to Vincent Snijders
Vincent Snijders wrote 9 lines
> [message] > Error: Incompatible types: got "constructor TRegIniFile.Create(const > AnsiString)" expected "TRegIniFile" > [/message] > I don't think it will fail. Overload is not required in mode objfpc as it is in Delphi.

Hmm... How it is so you dont think it fail? Or you suspect I imagine that error message :)

Best regards,
Paul Ishenin.

Reply by email

Marco van de Voort
to Florian Klaempfl
Show quoted text 6 lines
Vincent Snijders schrieb: > > I don't think it will fail. Overload is not required in mode objfpc as > it is in Delphi. Overload means Delphi like overloading, i.e. cross scope.

If the "overload" directive has any meaning nowadays, it should be corrected in the docs.

Reply by email

Florian Klaempfl
to Marco van de Voort
Show quoted text 7 lines
> Vincent Snijders schrieb: >> I don't think it will fail. Overload is not required in mode objfpc as >> it is in Delphi. > Overload means Delphi like overloading, i.e. cross scope. If the "overload" directive has any meaning nowadays, it should be corrected in the docs.

IIRC it has always this meaning?

Reply by email

Marco van de Voort
to Florian Klaempfl: IIRC it has always this meaning?
Show quoted text 10 lines
Marco van de Voort schrieb: >> Vincent Snijders schrieb: >>> I don't think it will fail. Overload is not required in mode objfpc as >>> it is in Delphi. >> Overload means Delphi like overloading, i.e. cross scope. > > If the "overload" directive has any meaning nowadays, it should be corrected > in the docs. IIRC it has always this meaning?

No, since cross unit overloading is new in 2.0 to begin with.

Reply by email

Paul Ishenin
to Jeff Wormsley
Jeff Wormsley wrote 28 lines
Given: TRegIniFile = class(TRegistry) .... public constructor Create(const FN: string); // <<-- no overload constructor Create(const FN: string;aaccess:longword); overload; .... The following must always fail: program project2; {$mode delphi} // mode has no difference ofcource but error message differ uses Registry; var Reg: TRegIniFile; begin Reg := TRegIniFile.Create; Reg.Free; end. You did not supply the filename of the INI file.

Please refer to delphi help for more info about TRegIniFile. In a few words - it is a class that allows to work with a windows registry as with an ini file.

Best regards,
Paul Ishenin.

Reply by email