[fpc-devel] Packages, Generics

Paulo Costa paco at fe.up.pt
Wed Sep 15 05:43:59 CEST 2010


On 13/09/2010 14:16, Florian Klaempfl wrote:
> Am 13.09.2010 14:51, schrieb Willibald Krenn:
>>
>>>> Well, it's the Delphi way of creating a new type rather than an
>>>> alias.
>>>
>>> Since they are still assignment compatible, I don't consider it as
>>> a really new type.
>>
>> Are you sure they are assignment compatible?
>
> I don't have a delphi here, but I'am pretty sure, yes.

It works that way.

The following snippet compiles and gives the expected result in D7

type TMyInteger = type Integer;

procedure TForm1.FormCreate(Sender: TObject);
var my: TMyInteger;
     notmy: integer;
begin
   my := 10;
   notmy := my;
   showmessage(inttostr(notmy));
   showmessage(inttostr(my));
end;

Paulo Costa



More information about the fpc-devel mailing list