Re: Function prefix comments in C files



"Bo" <bo@xxxxxxxxxx> wrote in message
news:51db6$434669a6$18d6ec55$16918@xxxxxxxxxxxxxx
> 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...

Steve
http://www.fivetrees.com


.