home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 4920 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 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: 06 Mar 96 18:36:15 +0100
  6. Organization: Dept of Computer Science, Utrecht University, The Netherlands
  7. Message-ID: <1378.6639T1116T760@cs.ruu.nl>
  8. References: <1286.6624T1439T237@cs.ruu.nl> <3Du8y*20g@yaps.rhein.de>
  9.         <3132C4BE.2D60@cs.ruu.nl> <4h3ivp$966@hasle.sn.no> <2099.6633T1231T2431@cs.ruu.nl> <4hie4f$978@wn1.sci.kun.nl>
  10. NNTP-Posting-Host: anx1p10.cc.ruu.nl
  11. X-Newsreader: THOR 2.22 (Amiga TCP/IP)
  12.  
  13. Olaf Seibert <rhialto@mbfys.kun.nl> wrote:
  14. > In <2099.6633T1231T2431@cs.ruu.nl> wsldanke@cs.ruu.nl (Wessel Dankers)
  15. > writes:
  16. >>I.e. you can't assume anything about the order in which a statement is
  17. >>evaluated. So, if I write:
  18. >>printf("%d", time(NULL));
  19. >>my compiler could very well first print the time and then ask the system
  20. >>what time it is. Interesting thought. So, if I have the right compiler I can
  21.  
  22. > Fortunately this is not true. The description of a function call says
  23. > that first the arguments are evaluated, then there is a sequence point,
  24. > then the funtion is called. I must admit that I would have to look up
  25. > what is said about the evaluation of the function to call (here it is
  26. > "printf" but it could have been something complicated like
  27. > "(mystruct.fpa[3 * i]->func)"):  would that be before that sequence
  28. > point, after, or undefined.
  29.  
  30. Hmmm. How about the C++ way,
  31. x.operator^=(y.operator^=(x.operator^=(y));
  32. That would introduce a sequence point, wouldn't it?
  33.  
  34. --
  35. Wessel Dankers                 _\\|//_            <wsldanke@cs.ruu.nl>
  36.                                ///|\\\
  37. ----------------------------oOO--(_)---OOo----------------------------
  38. `Never imagine yourself not to be otherwise than what it might appear
  39. to others that what you were or might have been was not otherwise than
  40. what you had been would have appeared to them to be otherwise.'
  41.  
  42.