??? 06/25/07 03:32 Read: times |
#141208 - Lesson complete Responding to: ???'s previous message |
Nice work Dan. The proper way to implement the code is to force sequence points at each operation:
// x^=y^=x^=y; x ^= y; y ^= x; x ^= y; Does what you expect and doesn't give the compiler hissy fits. Thanks Russ, for an interesting stroll down memory lane :-) (The original code is implementation dependent because even though the result is undefined by the language, a C compiler will try to generate code that does what it thinks you meant. Usually they guess right, but there's no guarantee.) |