in reply to Re^2: quickness is not so obvious
in thread quickness is not so obvious
If you are worried about dumb compilers why do you use post increment operators where the code logic doesn't care if it's a pre or post operator? Post "requires" an intermediate variable to save the pre-incremented value so it can be returned post increment.
This preference for post increment is pervasive and I can't think why that should be. To me pre-increment is king because it puts the operator out front where I can see it instead of hiding the operator behind a variable. I expect most modern compilers would optimise the code if the "return" value's not used in any case, but in an embedded context where the odd nano-second may be important using post-increment by default seems really odd if you don't trust the compiler.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: quickness is not so obvious
by RonW (Parson) on Jan 23, 2015 at 18:04 UTC | |
by GrandFather (Saint) on Jan 24, 2015 at 05:44 UTC | |
by Athanasius (Archbishop) on Jan 24, 2015 at 07:05 UTC | |
by LanX (Saint) on Jan 24, 2015 at 07:48 UTC | |
by RonW (Parson) on Jan 24, 2015 at 19:47 UTC | |
by LanX (Saint) on Jan 24, 2015 at 19:55 UTC | |
by GrandFather (Saint) on Jan 24, 2015 at 22:05 UTC | |
by RonW (Parson) on Jan 26, 2015 at 06:39 UTC | |
by RonW (Parson) on Jan 26, 2015 at 18:04 UTC | |
|