News for hackers. Stuff that matters.
Re:How to program an NES game in C by chrisseaton on Sunday August 13, 2017 @01:02PM (#15003723)
In a moderately sophisticated compiler, yes they should be the same thing.

The difference in the two is that the latter has to produce the original value, presumably by keeping it in a temporary variable. A compiler which looks at all the code in a function when optimising, rather than just blindly emitting code for each individual operation, will see that the value is not needed, and delete the temporary.

I guess cc65 is a bit more basic. Compilers for more unusual embedded environments are often a bit more basic, hence the general advice for the embedded context.

I think you could probably fix the compiler for this trivial case in the time it takes you to write down the advice though.

There are no comments on this comment yet.