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