Exactly.
I just wanted a 'hint' that swap might not be the best choice in all cases and that a speed consideration might take some investigation for the use in your program.
Thank you.
SWAP keyword
-
- Posts: 606
- Joined: Nov 28, 2012 1:27
- Location: CA, USA moving to WA, USA
- Contact:
-
- Posts: 2958
- Joined: Jun 02, 2015 16:24
Re: SWAP keyword
This information is important. It means then that we won't be able to swap 2 variables even if they are compatible with their UDTs having proper LET and CAST operators defined. If I understand well anyway. For standard types, like integer swap double, it works however... Not udt1 swap udt2.counting_pine wrote: And for UDTs, the contents of the structures are swapped without any operators or methods being called.
That's something that can look surprising if we considered swap as just a shortcut for the common method with temporary stuff. At least now all that makes it clear to me that it's something else.
Just curious, why is there the "See also:Operator = (Assignment)"?
Re: SWAP keyword
'Swap' works for any type of UDT.
If the UDT defines operators or methods, none of them will be called by the internal process of 'Swap'.
I reformulated the note again, to try to answer all your points of view.
If the UDT defines operators or methods, none of them will be called by the internal process of 'Swap'.
I reformulated the note again, to try to answer all your points of view.
Re: SWAP keyword
This part needs a reformulation, a statement "exactly what" SWAP does (no speculations, please).SWAP wrote:When the data are referenced by a pointer, alone or within a descriptive structure (a UDT, for example),it is usually best to onlySWAP only exchanges the values of the pointers or the contents of the descriptive structures without accessing data themselves.
strikeout = remove
underline = add, or change
Re: SWAP keyword
OK.
Re: SWAP keyword
Thank you.