[fpc-devel] Re: RFC: Delphi style class helpers

Sven Barth pascaldragon at googlemail.com
Fri Jan 7 12:01:45 CET 2011


Am 07.01.2011 11:20, schrieb Paul Ishenin:
> 07.01.2011 16:40, Marco van de Voort wrote:
>> Embarcadero Delphi for Win32 compiler version 22.0
>> Copyright (c) 1983,2010 Embarcadero Technologies, Inc.
>> tchlp36.dpr(23) Warning: W1036 Variable 'f' might not have been
>> initialized
>> tchlp36.dpr(25)
>> 26 lines, 0.03 seconds, 13512 bytes code, 13104 bytes data.
> While it compiles I think it is bug I believe. This should not be
> implemented so in FPC.
>
> Anyway, this better to report to Embarcadero forum and/or QC.

It seems to be intentional. If I change the code to the following:

=== source begin ===

program tchlp36;

type
   TBar = class
	
	end;

   TObjectHelper = class helper for TBar
     procedure Test;
   end;

   TFoo = class

   end;

   TFooHelper = class helper(TObjectHelper) for TFoo
   end;

procedure TObjectHelper.Test;
begin
end;

var
   f: TFoo;
begin
   f.Test;
end.

=== source end ===

I get the following output now:

=== output begin ===

P:\test>"c:\Programme\CodeGear\RAD Studio\5.0\bin\DCC32.EXE" tchlp36.pp
CodeGear Delphi für Win32 Compiler-Version 18.5
Copyright (c) 1983,2007 CodeGear
tchlp36.pp(19) Fehler: E2294 Eine von 'TObjectHelper' abgeleitete 
unterstützende
  Klasse steht nur für von  'TBar' abgeleitete Klassen zur Verfügung
tchlp36.pp(30)

=== output end ===

Rough translation of the error:
A class helper that inherits from 'TObjectHelper' is only available for 
classes that inherit from 'TBar'.

Regards,
Sven



More information about the fpc-devel mailing list