From: "Loren P Meissner" <[log in to unmask]>
Sent: Friday, 7 January 2011 3:59 AM
> Another operation, whose Fortran history I can't remember, would be an
> intrinsic function "SWAP (A, B)" that "simultaneously" assigns A to B and B
> to A, subject to all the constraints and interpretations of assignment?
> Wouldn't a compiler be able to optimize in some cases, as when one or both
> are in a register, and make it more efficient than "Temp = A; A = B; B =
I doubt whether it would be more efficient (optimisable).
The equivalent machine code for swap(a,b) would be
the same as temp=a; a = b; b = temp.
Nor is it (swapping) something that you see much of in actual code.