home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ornl!utkcs2!darwin.sura.net!spool.mu.edu!olivea!charnel!sifon!thunder.mcrcim.mcgill.edu!mouse
- From: mouse@thunder.mcrcim.mcgill.edu (der Mouse)
- Newsgroups: comp.lang.c
- Subject: Re: Question to test general C knowledge
- Message-ID: <1992Dec11.193346.22908@thunder.mcrcim.mcgill.edu>
- Date: 11 Dec 92 19:33:46 GMT
- References: <1992Dec10.195832.4305@leland.Stanford.EDU> <behrenss.724026637@hphalle6>
- Organization: McGill Research Centre for Intelligent Machines
- Lines: 30
-
- In article <behrenss.724026637@hphalle6>, behrenss@Informatik.TU-Muenchen.DE (Soenke Behrens) writes:
-
- > Hmm. ++i would mean it is incremented before using it in the
- > expression. Means I get three.
-
- Er, no. ++i means the value is the value after the increment. The
- increment itself may happen any time between the previous and next
- sequence points; in particular, it may happen after the assignment, and
- it may take the form of an increment or a storing of the new value.
-
- That is, it could be
-
- i = (old value plus 1) -- assignment
- i = (old value plus 1) -- increment
- or
- i = (old value plus 1) -- assignment
- i = (current value plus 1) -- increment
- or
- i = (old value plus 1) -- increment
- i = (old value plus 1) -- assignment
-
- Or, of course, since the same lvalue is being modified more than once,
- this is all academic anyway; it's equally legal to compile
-
- i = 42 -- undefined behavior
-
- der Mouse
-
- mouse@larry.mcrcim.mcgill.edu
-