The error of that code though is that now to use myfile, you must pass it to every function. A few extra pushes per function in a loop though can have a rather big performance penalty.
myfile is a *pointer*, so the size on the stack is the host system's pointer width.
If it wasn't a pointer, then yes, you would be passing it in full along the stack. That's what passing by reference is for.
local CPU class(passed on stack)
If you knew your language you would've passed by reference rather than passing the object on the stack. Or you would've used pointers.
It is for this reason, I no longer use C++... C++ is built for people wanting fastly developed code, not necessarily the fastest code, C is built to work anywhere and as fast as you would like to optimize it for.
It all comes down to knowledge and personal preference. It would seem to me you prefer C. I prefer C++. We can agree to disagree, but please don't point out "problems" with it that come down to faulty coding.