[fpc-pascal] Interface, _AddRef, _Release, etc.

Marcos Douglas md at delfire.net
Thu Sep 15 21:45:40 CEST 2011


On Thu, Sep 15, 2011 at 12:12 PM, Felipe Monteiro de Carvalho
<felipemonteiro.carvalho at gmail.com> wrote:
>
> On Thu, Sep 15, 2011 at 4:54 PM, Marcos Douglas <md at delfire.net> wrote:
> >>>   f := TFoo.Create;
> >>
> >> This is just wrong.
> >
> > Well, wrong just because the language is so but not because is ilogical, right?
>
> I don't understand why it would be wrong. For me it seams correct and
> similar to this example:
>
> http://wiki.lazarus.freepascal.org/How_To_Use_Interfaces_to_write_less_code

Yeah, you're right... I didn't see this link.  =)
But see it one more time: the R instance of TRealClass is not
released... saw? I didn't test but I think if R was released will
occur an AV.

> > I want my code compiling in Delphi 7 too, so I can have problems with this?
>
> You can always use {$ifndef fpc} and {$ifdef fpc} to write code
> specific to Delphi or FPC

Yes, but if I can do this using only one code is better than use
conditionals, don't you?

Marcos Douglas



More information about the fpc-pascal mailing list