Undoc'd Feature?
|
07-10-2022, 12:48 PM
Post: #26
|
|||
|
|||
RE: Undoc'd Feature?
(07-10-2022 10:22 AM)toml_12953 Wrote: I'd think the sequence would be Actually, no, it would yield 6 (store 5 in a and then increment a), which is possibly what the M$ compiler is doing. This is wrong, IMO, because the C/C++ standard clearly states that the result of an expression consisting of a post-incremented variable is the initial value of that variable. We are therefore totally justified in expecting "a = a++;" to assign to the variable a the value of the expression "a++", i.e.: the initial value of a. The evaluation should happen before the assignment. If a M$ compiler (and only that compiler) is returning anything else then I think we can chalk it up to some kind of compiler optimisation producing yet another "feature, not a bug". Current daily drivers: HP-41CL, HP-15C, HP-16C |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)