C++ inline vs. method

Robin2:
The Arduino is a very small program space compared with a PC.

Just use global variables - it saves an awful lot of trouble (and annoys the hell out of the C purists :)).

Aww man... no! :wink:

Since the array length (n) is known -- as opposed to being dynamic with a while (Serial.available()) or some such -- there's no reason not to pre-define the array and pass the pointer.

I know uC programming is different and thus there are exceptions to traditional best practices, but using globals just defeats the point of modularizing code into functions. If you still have all these symbol dependencies, why not just make it an anonymous block of code right in the function body instead?

IMH(?)O, functions should be as ignorant as possible to the symbols defined outside of their scope -- micro or not. It makes it so much easier to debug and re-use code when there aren't all these little interdependencies and side-effects going on everywhere.

-- C Purist. ]:)