Re: PLEASE HELP ME ! PLEASE
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Thu, 07 Jun 2007 13:01:28 -0700
Ben Bacarisse <ben.usenet@xxxxxxxxx> writes:
Richard Heathfield <rjh@xxxxxxxxxxxxxxx> writes:
Guru Jois said:<snip>
<snip>
<snip>Guru Jois wrote:
a^=b^=a; // could be still better than 3 statements.
If I'm wrong, I welcome the comment/objection from experts, b'cause I
always think - " learn from seniors ".
Okay, let's see if that's true.
4) the expression you gave is undefined because it violates a "shall"
that is not a constraint: "Between the previous and next sequence point
an object shall have its stored value modified at most once by the
evaluation of an expression. Furthermore, the prior value shall be
accessed only to determine the value to be stored."
I don't follow this last one. I am quite prepared to believe that I
am misunderstanding the phrase, but I am simply not seeing it.
a and b have their stored value modified only once (assuming a sequence
point just prior to this, of course) and to me reading of the prior
value of both a and b are used only to determine the value stored.
What have I missed?
I *think* you're right. Perhaps Richard was thinking of the "correct"
form of the xor swap kludge:
a^=b^=a^=b;
which still has a number of problems.
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
.
- Follow-Ups:
- Re: PLEASE HELP ME ! PLEASE
- From: Richard Heathfield
- Re: PLEASE HELP ME ! PLEASE
- References:
- PLEASE HELP ME ! PLEASE
- From: vubaboota
- Re: PLEASE HELP ME ! PLEASE
- From: Umesh
- Re: PLEASE HELP ME ! PLEASE
- From: Guru Jois
- Re: PLEASE HELP ME ! PLEASE
- From: Martin Ambuhl
- Re: PLEASE HELP ME ! PLEASE
- From: Richard Heathfield
- Re: PLEASE HELP ME ! PLEASE
- From: Guru Jois
- Re: PLEASE HELP ME ! PLEASE
- From: Richard Heathfield
- Re: PLEASE HELP ME ! PLEASE
- From: Ben Bacarisse
- PLEASE HELP ME ! PLEASE
- Prev by Date: Re: May fgetc() and friends return 163? Or UCHAR_MAX?
- Next by Date: Re: struct with pointers
- Previous by thread: Re: PLEASE HELP ME ! PLEASE
- Next by thread: Re: PLEASE HELP ME ! PLEASE
- Index(es):
Relevant Pages
|