home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!asuvax!chnews!sedona!bhoughto
- From: bhoughto@sedona.intel.com (Blair P. Houghton)
- Newsgroups: comp.lang.c
- Subject: Re: NH-- > NH
- Date: 10 Jan 1993 23:14:45 GMT
- Organization: Intel Corp., Chandler, Arizona
- Lines: 27
- Message-ID: <1iqal5INNbef@chnews.intel.com>
- References: <1993Jan4.140735.11269@wisipc.weizmann.ac.il> <1993Jan7.002651.10741@oracle.us.oracle.com> <C0JMw6.680@netnews.jhuapl.edu>
- NNTP-Posting-Host: stealth.intel.com
-
- In article <C0JMw6.680@netnews.jhuapl.edu> bandy@netnews.jhuapl.edu (Mike Bandy) writes:
- >In article <1993Jan4.140735.11269@wisipc.weizmann.ac.il> fedimit@wisipc.weizmann.ac.il (Dan Nabutovsky) writes:
- >
- >> Do you know that the expression NH-- > NH is always true in C ?
- >>The reason is that NH-- returns NH before decrementing, and then
- >>NH returns NH after decrementing.
- >> Similarly, NH++ < NH--
- >
- >So what you're saying is that NH > NH. I don't believe it. Your
- >compiler (or your logic) has some serious problems.
-
- The order of evaluation of operands in a binary expression
- is implementation defined.
-
- Some implementations will get NH-- on the left before
- getting NH on the right; some will get NH on the right
- before getting NH-- on the left.
-
- In the case of an ANSI conformant implementation, writing
- this line of code results in undefined behavior (say
- goodbye to your Guccis).
-
- This is in the FAQ; Q 4.1.
-
- --Blair
- "I'm in the FAQ, too, but
- nobody asks me any more..."
-