home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / c / 19456 < prev    next >
Encoding:
Text File  |  1993-01-08  |  1.8 KB  |  47 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!gatech!paladin.american.edu!howland.reston.ans.net!usc!cs.utexas.edu!sun-barr!ames!data.nas.nasa.gov!mustang.mst6.lanl.gov!nntp-server.caltech.edu!draco.macsch.com!convex.is.macsch.com!dnl
  3. From: dnl@convex.is.macsch.com (David Lombard)
  4. Subject: Re: NH-- > NH
  5. Message-ID: <1993Jan9.010946.3172@draco.macsch.com>
  6. Sender: usenet@draco.macsch.com (Usenet Poster)
  7. Organization: MacNeal-Schwendler Corp.
  8. References: <1993Jan7.002651.10741@oracle.us.oracle.com> <C0JMw6.680@netnews.jhuapl.edu> <1993Jan8.210335.28340@sharebase.com>
  9. Date: Sat, 9 Jan 93 01:09:46 GMT
  10. Lines: 35
  11.  
  12. In article <1993Jan8.210335.28340@sharebase.com> keith@torme.sharebase.com (Keith Chambless) writes:
  13. >In article <C0JMw6.680@netnews.jhuapl.edu> bandy@netnews.jhuapl.edu (Mike Bandy) writes:
  14. >>
  15. >>So what you're saying is that NH > NH.  I don't believe it.  Your 
  16. >>compiler (or your logic) has some serious problems.
  17. >
  18. >
  19. >Weird. Mine (Solbourne w/OS/MP 4.0) works the same:
  20. >
  21. >    if (nh-- > nh)
  22. >      printf("nh-- > nh = true\n");
  23. >
  24. >prints true. I don't understand.
  25.  
  26.  
  27. First, the original author of "nh-- > nh" should be shot (unless of course
  28. it's meant as a jest, a trick question, or an extract from some obfuscated
  29. programming contest:-)
  30.  
  31. As far as why it _is_ working, the operation nh-- is executed _before_ the 
  32. second reference to nh is used.  A way to look at the comparison (ingoring
  33. the side effect) is:
  34.  
  35.     nh > (nh-1)
  36.  
  37. Never confuse "Gee it works" with "that's the result you should expect."
  38.  
  39. Regards,
  40. DNL
  41.  
  42.                  MY_COMMENTS = MY_OPINIONS = NOBODY_ELSES;
  43.  
  44. David N. Lombard    The first thing we do,         The MacNeal-Schwendler Corp
  45. dnl@macsch.com      Let's kill all the lawyers.    815 Colorado Blvd
  46. (213) 259-4911      II Henry VI, IV.ii             Los Angeles, CA  90041
  47.