I guess avoiding functions may have been relevant with dumb compilers, a
few decades ago. Compilers today are pretty good at optimizing and,
since recently, the Arduino environment enables “link time
optimization”. This means the optimizer can see the whole program at
once, which enables:
function inlining across compilation units (and the optimizer does
A friend has told me I shouldn't rely on functions because, during execution, they occupy a significant amount of RAM.
I wouldn't say "significant", but some RAM is used, yes.
Every time a function is called any registers used in the execution of that function are placed onto the stack. Also some parameters to the function may be passed on the ...