home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / c / 18521 < prev    next >
Encoding:
Internet Message Format  |  1992-12-17  |  1.5 KB

  1. Path: sparky!uunet!mcsun!sun4nl!and!jos
  2. From: jos@and.nl (Jos Horsmeier)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Question to test general C knowledge
  5. Message-ID: <4238@dozo.and.nl>
  6. Date: 17 Dec 92 08:40:51 GMT
  7. References: <1992Dec16.180117.72534@ns1.cc.lehigh.edu>
  8. Organization: AND Software BV Rotterdam
  9. Lines: 32
  10.  
  11. In article <1992Dec16.180117.72534@ns1.cc.lehigh.edu> dsbb@ns1.cc.lehigh.edu (D. SPENCER BEECHER) writes:
  12. |>>>>    int i = 2;
  13. |>>>>    i = ++i;
  14. |>>> If they say other than "it's undefined", *then* don't hire them.
  15. |
  16. |After reading much discussion on this matter, I have only
  17. |one question:
  18. |
  19. |On what page of the white book does it indicate precedence in
  20. |evaluation of the above statement?
  21.  
  22. Ok, one more time: precedence in evaluation has got nothing to do with this.
  23. The behavior is undefined, it was undefined, it is undefined and, as far as
  24. I can tell, it will allways be undefined. If an object changes value between
  25. two sequence points more than once, the final result is undefined.
  26.  
  27. |I would compare this to the line:
  28. |
  29. |putchar(c)=getchar();
  30. |
  31. |(which, by the way, does NOT work on any but the most forgiving compilers)
  32.  
  33. This is utter nonsense. If a compiler accepts this, I wouldn't call it
  34. `forgiving', I would call it `braindead'. The left hand side of an 
  35. assignment expression has to be a modifiable left hand value (or object,
  36. as you wish). the putchar() function (or macro) isn't even a left hand
  37. value. But you're right: putchar(c)= getchar() can be compared to
  38. i= ++i. They're both utter nonsense. ;-)
  39.  
  40. kind regards,
  41.  
  42. Jos aka jos@and.nl
  43.