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

  1. Path: cs.ruu.nl!usenet
  2. From: wsldanke@cs.ruu.nl (Wessel Dankers)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: x ^= y ^= x ^= y;
  5. Date: 01 Mar 96 16:41:47 +0100
  6. Organization: Dept of Computer Science, Utrecht University, The Netherlands
  7. Message-ID: <1547.6634T1001T2383@cs.ruu.nl>
  8. References: <4glcf7$eou@wn1.sci.kun.nl> <972.6628T1080T1212@cs.ruu.nl> <4h4ta6$ivf@elmer.tsc.com>
  9. NNTP-Posting-Host: anx1p8.cc.ruu.nl
  10. X-Newsreader: THOR 2.22 (Amiga TCP/IP)
  11.  
  12. Bill Roberts <billr@elmer.tsc.com> wrote:
  13. > Wessel Dankers <wsldanke@cs.ruu.nl> wrote:
  14. >>>> Or, if you want it real fancy:
  15. >>>> x ^= y ^= x ^= y;
  16. >>> <snip statement that you can't do this and why>
  17. >> <snip statement that you can do this and why>
  18.  
  19. > The result of the evaluations is done in the order you have shown.
  20. > The storage does not have to be done in the order shown.  Therefore, x
  21. That's the first sensible thing I see. It doesn't help if one mumbles things
  22. about "sequence points": although they are the right words they don't explain
  23. anything.
  24.  
  25. Well, if it's defined this way there is nothing to argue about. All we can do
  26. is flame Kernighan and/or Ritchie. Anyone have an e-mail address? :-)
  27.  
  28. > could end up with either of the value of the first xor or the second
  29. > xor.  The same for y.  It may work on the compiler you are using.  It
  30. Or it may work without an optimizer but refuse to work once you switch it on.
  31.  
  32. > may not work on another equally correct compiler.  This case is
  33. > specifically stated as producing undefined results in the ANSI C
  34. > standard.  The comp.lang.c FAQ's specifically discuss this problem and
  35. > why it is undefined.
  36.  
  37.  
  38. --
  39. Wessel Dankers                 _\\|//_            <wsldanke@cs.ruu.nl>
  40.                                ///|\\\
  41. ----------------------------oOO--(_)---OOo----------------------------
  42. `Never imagine yourself not to be otherwise than what it might appear
  43. to others that what you were or might have been was not otherwise than
  44. what you had been would have appeared to them to be otherwise.'
  45.  
  46.