Undoc'd Feature?
|
07-12-2022, 11:03 AM
(This post was last modified: 07-12-2022 11:04 AM by RPNerd.)
Post: #31
|
|||
|
|||
RE: Undoc'd Feature?
(07-11-2022 07:49 PM)ijabbott Wrote: However, for `i = i++;`, the `i++` part says that the old value of `i` plus 1 will be stored in `i`, and the `i = i` part says that the old value of `i` will be stored in `i`, so there is a conflict. I see no conflict there. in: Code: i = i++; ...as in any assignment, the rhs is evaluated so that the result can be assigned to the lhs variable, which just happens to be the same variable in this particular case. "i++" is evaluated as the initial value of i. A by-product of that evaluation is post-incrementing i but that doesn't matter because the initial value is then assigned back to i. Basically, the result is a big fat NOP with a few CPU cycles wasted incrementing i and then setting it back to its original value unless the compiler catches this. Current daily driver: HP 71B w/FRAM 71B |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)