Introduce static get and set functions for ControlObject#28
Conversation
|
LGTM -- it may be useful to provide a default value or a bool* that is set if the control existed or not but whoever needs that first can add it. |
|
Thank you for review! |
Introduce static get and set functions for ControlObject
There was a problem hiding this comment.
Alright, I know this has already been merged -- but what reasoning exists for taking a constant ref to a double instead of just passing a double?
For all the stylistic nits I see being picked on in github mail, this seems exceptionally odd to go uncommented.
There was a problem hiding this comment.
I don't see any style issues. The & is in the right place :P.
Doubles are 64-bit so on a 32-bit platform passing by reference is slightly less data to push on the stack.
There was a problem hiding this comment.
That might be my favourite comment ever, Bill. 👍
There was a problem hiding this comment.
It is not worth talking about, but since I am an embedded developer I wanted to know. So I have written a test with an interesting results:
- When passing a double or a double& to a function with compatible parameters there is no difference because the parameters are not touched.
- When passing a double to a function with incompatible parameters it requires two more instructions then a double& on a 32bit target. On a 64 bit target it is the same.
- Making a double from a double& takes at least on instruction more for fetching the address of the defence on both architectures.
- passing a double& in one call and the passing a double in a sub call takes 3 instructions more than passing double in both calls, on a both targets. On a 64 bit system both versions are two instructions shorter.
Conclusion:
There is no general answer what is best, but we should avoid converting between double and double&.
Fix typo: "comment line" -> "command line"
This is a next step to get rid of the double hash in CO and COP