[comp.lang.c] swap macro

glen@astroatc.UUCP (Glen Ecklund) (02/03/88)

> #define swap(a,b) ((a) = ((b) = ((a) = (a) ^ (b)) ^ (b)) ^ (a))
                                   <1>                       <2>

I'm surprised that nobody has picked the nit that drew my attention.
This macro requires the first assignment, at <1>, to be completed
before the last (a), at <2>, is evaluated.  My reading of K&R says
this cannot be assured.  Or did I miss something?

Glen Ecklund