Re: Function prefix comments in C files
- From: "Steve at fivetrees" <steve@xxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 7 Oct 2005 14:44:18 +0100
"Bo" <bo@xxxxxxxxxx> wrote in message
> How would you, in C, NOT use a global in the following circumstance?
> 100us counter incremented by an ISR
> access needed to read us counter by ALL modules?
I'm also anti-globals, but by "globals" I mean "global to all modules".
Within a given module (i.e. a .c file), I do allow globals - i.e. variables
that are within scope for that module, but out of scope to all others. (To
be precise, I usually define a class - actually a structure - which contains
any variables which are in-scope within that module.)
Accessor functions can then be of project-global scope, but provide real
protection: a read function can *only* read, while a write function (if
required) does so in a strictly controlled manner.
I haven't used an actual global global in maybe 15 years...