home *** CD-ROM | disk | FTP | other *** search
- Path: cs.ruu.nl!usenet
- From: wsldanke@cs.ruu.nl (Wessel Dankers)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: x ^= y ^= x ^= y;
- Date: 01 Mar 96 16:41:47 +0100
- Organization: Dept of Computer Science, Utrecht University, The Netherlands
- Message-ID: <1547.6634T1001T2383@cs.ruu.nl>
- References: <4glcf7$eou@wn1.sci.kun.nl> <972.6628T1080T1212@cs.ruu.nl> <4h4ta6$ivf@elmer.tsc.com>
- NNTP-Posting-Host: anx1p8.cc.ruu.nl
- X-Newsreader: THOR 2.22 (Amiga TCP/IP)
-
- Bill Roberts <billr@elmer.tsc.com> wrote:
- > Wessel Dankers <wsldanke@cs.ruu.nl> wrote:
- >>>> Or, if you want it real fancy:
- >>>> x ^= y ^= x ^= y;
- >>> <snip statement that you can't do this and why>
- >> <snip statement that you can do this and why>
-
- > The result of the evaluations is done in the order you have shown.
- > The storage does not have to be done in the order shown. Therefore, x
- That's the first sensible thing I see. It doesn't help if one mumbles things
- about "sequence points": although they are the right words they don't explain
- anything.
-
- Well, if it's defined this way there is nothing to argue about. All we can do
- is flame Kernighan and/or Ritchie. Anyone have an e-mail address? :-)
-
- > could end up with either of the value of the first xor or the second
- > xor. The same for y. It may work on the compiler you are using. It
- Or it may work without an optimizer but refuse to work once you switch it on.
-
- > may not work on another equally correct compiler. This case is
- > specifically stated as producing undefined results in the ANSI C
- > standard. The comp.lang.c FAQ's specifically discuss this problem and
- > why it is undefined.
-
-
- --
- Wessel Dankers _\\|//_ <wsldanke@cs.ruu.nl>
- ///|\\\
- ----------------------------oOO--(_)---OOo----------------------------
- `Never imagine yourself not to be otherwise than what it might appear
- to others that what you were or might have been was not otherwise than
- what you had been would have appeared to them to be otherwise.'
-
-