vcl - Self-Assignment in Delphi -


There is a common phrase in the assignment operator in C ++, where you have to remove the object due to the copy of the object.

But, in Delphi VCL (at least D-2010) it seems that it is not being handled properly.

For example, the following tasks will be passed Clear to TStringList !

  The process starts foo (var wire: TStringList) wire. Wire (wire); End;   

Is it still a problem with later versions of Delphi - or is there a common way of dealing with this problem?

Self-assignment in Delphi is rare, which is why it is not commonly checked for it. Since the examples of the class should be allocated on the heap, and the assignment operator is not exaggerated in the sections, the assignment must be explicitly from one object to another, such as TPersistent.Assign () . The majority of Delphi users understand that the code is not written, which will provide the object in itself, by mistake or otherwise.

Self assignment in C ++ is more common, especially when it may actually be generated by the compiler in some cases. And the assignment operator is overloadable, so it makes more sense to check the assignment itself in C ++.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -