Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/31/05 10:32
Read: times


 
#103165 - "Generally" being the important word!
Responding to: ???'s previous message
Andy Peters said:
Admittedly, for small designs, globals may not be evil, and perhaps even the constraints of embedded systems (limited memory, etc) make them attractive.

The disadvantage of parameter-passing, of course, is that it incurs a run-time overhead.

However, another advantage of parameter-passing (particularly with memory-constrained 8051s) is that the parameters only consume memory space while they are actually being used.
Globals occupy their memory locations permanently; they cannot be overlaid by the compiler.

As with anything, there are pros and cons - you should neither use nor avoid globals without properly understanding what you're doing and why!




List of 12 messages in thread
TopicAuthorDate
Using Multiple C files in SDCC            01/01/70 00:00      
   Not about the compiler            01/01/70 00:00      
   Nothing to do with SDCC            01/01/70 00:00      
   The joy of C            01/01/70 00:00      
      Sloppy terminology            01/01/70 00:00      
         Using Multiple C files in SDCC            01/01/70 00:00      
            Laziness            01/01/70 00:00      
            example            01/01/70 00:00      
   globals are generally bad ...            01/01/70 00:00      
      "Generally" being the important word!            01/01/70 00:00      
         re Globals            01/01/70 00:00      
      static            01/01/70 00:00      

Back to Subject List