Multiple Assignment Evaluation Debate
- From: berns@xxxxxxxxxxxx
- Date: 9 Mar 2006 20:45:30 -0800
Hi All,
A coworker and I have been debating the 'correct' expectation of
evaluation for the phrase a = b = c. Two different versions of GCC
ended up compiling this as b = c; a = b and the other ended up
compiling it as a = c; b = c. (Both with no optimizations enabled).
How did we notice you may ask? Well, in our case 'b' was a memory
mapped register that only has a select number of writable bits. He
claims it has been a 'C Standard' that it will be evaluted as a = c; b
= c. I personally believe that it would make more sense for it to be
evaluated as b = c; a = b, although I would never write code that has a
questionable operation. Can anyone settle this debate?
.
- Follow-Ups:
- Re: Multiple Assignment Evaluation Debate
- From: Chris Torek
- Re: Multiple Assignment Evaluation Debate
- From: Jordan Abel
- Re: Multiple Assignment Evaluation Debate
- From: Richard Heathfield
- Re: Multiple Assignment Evaluation Debate
- Prev by Date: Re: Learning C
- Next by Date: Re: Please Comment on this Integer to String Code.
- Previous by thread: Learning C
- Next by thread: Re: Multiple Assignment Evaluation Debate
- Index(es):
Relevant Pages
|