Closed ondras12345 closed 1 year ago
Thank you! Really good idea, I like it. Tonight maybe I will have some time to close this PR.
I think I will create a dedicated function for this line:
response -> print( FF( "Argument error!" ) );
I don't think that's necessary. The compiler will most likely merge identical string literals. If it doesn't inline your function, it might actually increase code size. But feel free to try it. I'd ensure that the string is always the same, for example with something like this:
#define COMMANDER_ARGUMENT_ERROR "Argument error!"
But that should be sufficient.
This should make the code more readable with no change at all to the compiled binary. It should also make it easier to change these string literals in the future as there are no longer multiple occurrences that need changing.
The name of the new macro
FF()
is arbitrary, I just thought it should be short.I also removed some unnecessary casts of string literals to
const char *
.I was unable to test Commander-API-Commands because they seem to be broken at the
dev
branch.