Hi all,
one of the recent post gives the macro to do swap
#define SWAP(m, n) (tmp = (m), (m) = (n), (n) = tmp)
This macro will work, if the execution is from left to right.
That is step 1) tmp=m
step 2) m=n
step 3) n=tmp
But I hope order of execution is decided by the compiler.
Does C specification is saying any thing about this order of exectuion?
Will this macro work on all compilers?
Plz share your thoughts...
Thanks
Sabi
one of the recent post gives the macro to do swap
#define SWAP(m, n) (tmp = (m), (m) = (n), (n) = tmp)
This macro will work, if the execution is from left to right.
That is step 1) tmp=m
step 2) m=n
step 3) n=tmp
But I hope order of execution is decided by the compiler.
Does C specification is saying any thing about this order of exectuion?
Will this macro work on all compilers?
Plz share your thoughts...
Thanks
Sabi
Comment