home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / c / 19509 < prev    next >
Encoding:
Internet Message Format  |  1993-01-10  |  1.4 KB

  1. Path: sparky!uunet!cs.utexas.edu!asuvax!chnews!sedona!bhoughto
  2. From: bhoughto@sedona.intel.com (Blair P. Houghton)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: NH-- > NH
  5. Date: 10 Jan 1993 23:14:45 GMT
  6. Organization: Intel Corp., Chandler, Arizona
  7. Lines: 27
  8. Message-ID: <1iqal5INNbef@chnews.intel.com>
  9. References: <1993Jan4.140735.11269@wisipc.weizmann.ac.il> <1993Jan7.002651.10741@oracle.us.oracle.com> <C0JMw6.680@netnews.jhuapl.edu>
  10. NNTP-Posting-Host: stealth.intel.com
  11.  
  12. In article <C0JMw6.680@netnews.jhuapl.edu> bandy@netnews.jhuapl.edu (Mike Bandy) writes:
  13. >In article <1993Jan4.140735.11269@wisipc.weizmann.ac.il> fedimit@wisipc.weizmann.ac.il (Dan Nabutovsky) writes:
  14. >
  15. >>   Do you know that the expression NH-- > NH is always true in C ?
  16. >>The reason is that NH-- returns NH before decrementing, and then
  17. >>NH returns NH after decrementing.
  18. >>   Similarly, NH++ < NH--
  19. >
  20. >So what you're saying is that NH > NH.  I don't believe it.  Your 
  21. >compiler (or your logic) has some serious problems.
  22.  
  23. The order of evaluation of operands in a binary expression
  24. is implementation defined.
  25.  
  26. Some implementations will get NH-- on the left before
  27. getting NH on the right; some will get NH on the right
  28. before getting NH-- on the left.
  29.  
  30. In the case of an ANSI conformant implementation, writing
  31. this line of code results in undefined behavior (say
  32. goodbye to your Guccis).
  33.  
  34. This is in the FAQ; Q 4.1.
  35.  
  36.                 --Blair
  37.                   "I'm in the FAQ, too, but
  38.                    nobody asks me any more..."
  39.