??? 09/18/06 23:27 Read: times |
#124522 - Global variables Responding to: ???'s previous message |
Erik - global variables and modular programming can be mentioned in the one sentence. The base concept of modular programming is to have 'modules' and to have 'loose' coupling between them. Having modules with 'tight' coupling makes the code hard to understand and debug. Using global variables may cause tight coupling. Nevertheless, you have to use global variables to talk between interrupt code and non-interrupt code. Here, you try to make the coupling simple and obvious.
As anyone experienced in embedded systems knows - sometimes you have to break the 'rules'. Sometimes its for speed or size - but you know the reason behind it and will normally pop in a comment saying as much. Everything is a compromise! As for the 'c is self documenting' mantra - I've not heard of this before. Maybe I don't get out enough. |