<=> and obfuscation
hammond at petrus.UUCP
hammond at petrus.UUCP
Fri Feb 8 23:59:39 AEST 1985
> > To exchange two items without an intermediate variable, try:
> >
> > b ^= a ^= b ^= a
>
> However, if a == b when you start out, you end up with a == 0 && b == 0.
>
NO!, I just tried it on our compiler, if a!=0 && b!=0 && a==b then
after the suggested line the variables still have the same value.
>
> This also only works on integer style variables.
Good point.
More information about the Comp.lang.c
mailing list