home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!pipex!warwick!uknet!mcsun!sun4nl!and!jos
- From: jos@and.nl (Jos Horsmeier)
- Newsgroups: comp.lang.c
- Subject: Re: NH-- > NH
- Message-ID: <4320@dozo.and.nl>
- Date: 9 Jan 93 14:16:08 GMT
- References: <1993Jan7.002651.10741@oracle.us.oracle.com> <C0JMw6.680@netnews.jhuapl.edu> <1993Jan8.210335.28340@sharebase.com>
- Organization: AND Software BV Rotterdam
- Lines: 25
-
- In article <1993Jan8.210335.28340@sharebase.com> keith@torme.sharebase.com (Keith Chambless) writes:
- |In article <C0JMw6.680@netnews.jhuapl.edu> bandy@netnews.jhuapl.edu (Mike Bandy) writes:
- |>
- |>So what you're saying is that NH > NH. I don't believe it. Your
- |>compiler (or your logic) has some serious problems.
- |
- |
- |Weird. Mine (Solbourne w/OS/MP 4.0) works the same:
- |
- | if (nh-- > nh)
- | printf("nh-- > nh = true\n");
- |
- |prints true. I don't understand.
-
- Welcome to the wonderful world of undefined behavior. The postfix `--'
- operator is guaranteed to be completed at the first sequence point.
- The sequence point in a controlling expression of an if statement
- is at the right parenthesis. Before that point, nobody knows when
- the value 1 is subtracted from identifier `nh'. And even more: there
- is no left to right evaluation guaranteed for a comparison operator.
- Anything can be expected here ...
-
- kind regards,
-
- Jos aka jos@and.nl
-