Re: Function prefix comments in C files
- From: "Michael N. Moran" <mike@xxxxxxxxxxx>
- Date: Fri, 07 Oct 2005 13:57:34 -0400
Bo wrote:
"Peter Bushell" <NOpeter.bushell@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:43464d78_4@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxI strongly agree with David over this. However, I do not believe he has gone far enough. Global variables are **bad news**! I've seen so many problems with their use over a long career, that I eventually decided to stop using them altogether.
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?
When you are dealing with time critical code, you don't have the luxury of accessor functions.
When you have very limited resources (RAM/ROM), ditto.
When you have a VERY limited stack? or no real C stack at all? (ie the stack is emulated by use of registers by the compiler)
I'm not going to argue the point that this is not the preferred/std method of writing C.
Good. What you described, however, are execeptions to the rule ... and there are *always* exceptions. However, the *rule* from a portability and maintainability point-of-view is best served as Peter suggests.
Agreed, however, that in a resource constrained environment, execeptions are frequently legion.
-- Michael N. Moran (h) 770 516 7918 5009 Old Field Ct. (c) 678 521 5460 Kennesaw, GA, USA 30144 http://mnmoran.org
"So often times it happens, that we live our lives in chains and we never even know we have the key." The Eagles, "Already Gone"
The Beatles were wrong: 1 & 1 & 1 is 1
.
- Follow-Ups:
- Re: Function prefix comments in C files
- From: Anton Erasmus
- Re: Function prefix comments in C files
- References:
- Re: Function prefix comments in C files
- From: Dan Henry
- Re: Function prefix comments in C files
- From: Mark McDougall
- Re: Function prefix comments in C files
- From: Bo
- Re: Function prefix comments in C files
- From: Peter Bushell
- Re: Function prefix comments in C files
- From: Bo
- Re: Function prefix comments in C files
- Prev by Date: Re: Function prefix comments in C files
- Next by Date: Re: Function prefix comments in C files
- Previous by thread: Re: Function prefix comments in C files
- Next by thread: Re: Function prefix comments in C files
- Index(es):