SWAP keyword

Forum for discussion about the documentation project.
speedfixer
Posts: 606
Joined: Nov 28, 2012 1:27
Location: CA, USA moving to WA, USA
Contact:

Re: SWAP keyword

Post by speedfixer »

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.
Tourist Trap
Posts: 2958
Joined: Jun 02, 2015 16:24

Re: SWAP keyword

Post by Tourist Trap »

counting_pine wrote: And for UDTs, the contents of the structures are swapped without any operators or methods being called.
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.

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)"?
fxm
Moderator
Posts: 12083
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: SWAP keyword

Post by fxm »

'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.
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: SWAP keyword

Post by MrSwiss »

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 only SWAP only exchanges the values of the pointers or the contents of the descriptive structures without accessing data themselves.
This part needs a reformulation, a statement "exactly what" SWAP does (no speculations, please).
strikeout = remove
underline = add, or change
fxm
Moderator
Posts: 12083
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: SWAP keyword

Post by fxm »

OK.
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: SWAP keyword

Post by MrSwiss »

Thank you.
Post Reply