Ryan Joseph <r...@thealchemistguild.com> schrieb am Sa., 18. Aug. 2018, 19:38:
> > > > On Aug 17, 2018, at 7:19 PM, Sven Barth via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > > However for classes there is the problem of temporary variables. Take a > := b + c + d. That is essentially compiled as t := b + c; a := t + d. The > compiler does not know whether the operator creates an instance or not > (yes, there are circumstances when it can know that, but for the general > case it can't) and thus this would potentially lead to memory leaks. > > > > I’m must be confused because classes already have operator overloads, > they’re just in global scope outside of the class itself. Don’t all the > same rules apply if the syntax is put inside the class (like in records) > just the scope rules change? > Delphi does not have global operator overloads and in FPC the problem I mentioned indeed happens with global overloads. It's just that not many people use global overloads for classes (especially now that generics are used more). Regards, Sven >
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal