home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 3745 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  859 b 

  1. Path: severus.mbfys.kun.nl!rhialto
  2. From: rhialto@mbfys.kun.nl (Olaf Seibert)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: x ^= y ^= x ^= y;
  5. Date: 23 Feb 1996 21:44:07 GMT
  6. Organization: University of Nijmegen, The Netherlands
  7. Distribution: world
  8. Message-ID: <4glcf7$eou@wn1.sci.kun.nl>
  9. References: <1286.6624T1439T237@cs.ruu.nl>
  10. NNTP-Posting-Host: severus.mbfys.kun.nl
  11.  
  12. In <1286.6624T1439T237@cs.ruu.nl> wsldanke@cs.ruu.nl (Wessel Dankers) writes:
  13. >Which can of course be rewritten as:
  14. >
  15. > x ^= y;
  16. > y ^= x;
  17. > x ^= y;
  18. >
  19. >or if you want it real fancy:
  20. >
  21. > x ^= y ^= x ^= y;
  22.  
  23. No. you can't do this last step. You are modifying the same variable
  24. (two variables even) twice between sequence points.
  25.  
  26. -Olaf.
  27. --
  28. ___ Olaf 'Rhialto' Seibert      rhialto@mbfys.kun.nl      The only excuse
  29. \X/    for making a useless thing is that one admires it intensely. -O.W.
  30.