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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/23/02 17:44
Read: times


 
#19027 - RE: typedef & optimisation?
Looking back at my posting, I see that I abbreviated rather badly describing the method. I have used 2 methods, both have their advantages. For brevity I show unsigned char only this time.

Method 1

in one .c module only
#define MAIN

in global_variables.h (included in all .c's)
#define U8 unsigned char
#ifdef MAIN
#define GU8 U8
#else
#define GU8 extern U8
#endif

U8 a_local_variable (NOT used inside global_variables.h)
GU8 a_global_variable (used ONLY inside global_variables.h except as above)



Method 2

in one .c module only
#define MAIN

in global_variables.h (included in all .c's)
#define U8 unsigned char
#ifdef MAIN
#define EXT extern
#else
#define EXT
#endif

EXT U8 a_global_variable (used ONLY inside global_variables.h)
U8 a_local_variable (NOT used inside global_variables.h )


Sorry abt the excess shorthand, hope this clarifies the method.

Erik


List of 21 messages in thread
TopicAuthorDate
typedef & optimisation?            01/01/70 00:00      
RE: typedef & optimisation?            01/01/70 00:00      
RE: typedef & optimisation?            01/01/70 00:00      
RE: typedef & optimisation?            01/01/70 00:00      
RE: typedef & optimisation?            01/01/70 00:00      
RE: typedef & optimisation?            01/01/70 00:00      
RE: typedef & optimisation?            01/01/70 00:00      
RE: typedef & optimisation?            01/01/70 00:00      
RE: typedef & optimisation?            01/01/70 00:00      
RE: typedef & optimisation?            01/01/70 00:00      
RE: typedef & optimisation? Derek            01/01/70 00:00      
RE: typedef & optimisation? Peter            01/01/70 00:00      
RE: typedef & optimisation Franc            01/01/70 00:00      
RE: typedef & optimisation? Erik            01/01/70 00:00      
RE: typedef & optimisation? Peter            01/01/70 00:00      
RE: typedef & optimisation? Peter/Erik            01/01/70 00:00      
RE: typedef & optimisation? Peter/Erik            01/01/70 00:00      
RE: typedef & optimisation? Peter/Erik            01/01/70 00:00      
RE: typedef & optimisation?            01/01/70 00:00      
RE: typedef & optimisation?            01/01/70 00:00      
RE: typedef & optimisation?            01/01/70 00:00      

Back to Subject List