Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass by reference #16

Open
WhiskyDelta opened this issue Nov 5, 2022 · 0 comments
Open

Pass by reference #16

WhiskyDelta opened this issue Nov 5, 2022 · 0 comments

Comments

@WhiskyDelta
Copy link

This lib makes heavy use of pass by reference, even where it is not necessary or even counterproductive.
For example since smlState expects a unsigned char & one can not do something like currentState = smlState(Serial.read()).
I don't think passing by reference of primitive types like char has any performance advantages, on the contrary it is probably even slower than just passing by value since the address is bigger than the value.
If you really want to pass by reference here you should make it const unsigned char & to avoid having to read the bytes into a variable befor passing to smlState.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant