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

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