D
David T. Ashley
Hi,
In my project, I typically declare and define variables in the .H
file, i.e.
DECMOD_MAIN UINT8 can_message_201_status_global
#ifdef MODULE_MAIN
= HAS_NEVER_BEEN_RECEIVED
#endif
;
where DECMOD_MAIN expands to nothing when compiling MAIN.C and expands
to "extern" when compiling other modules.
Is there a neater and more compact way to handle the initializers
(which appear in the definition but not in the declaration)? The
above (in the MAIN.H file) works, but it is inelegant. What are
others doing?
Again the goal is to define, declare, and initialize variables all in
the same place (to avoid having to keep consistency between the .C and
..H files).
Thanks, Dave.
In my project, I typically declare and define variables in the .H
file, i.e.
DECMOD_MAIN UINT8 can_message_201_status_global
#ifdef MODULE_MAIN
= HAS_NEVER_BEEN_RECEIVED
#endif
;
where DECMOD_MAIN expands to nothing when compiling MAIN.C and expands
to "extern" when compiling other modules.
Is there a neater and more compact way to handle the initializers
(which appear in the definition but not in the declaration)? The
above (in the MAIN.H file) works, but it is inelegant. What are
others doing?
Again the goal is to define, declare, and initialize variables all in
the same place (to avoid having to keep consistency between the .C and
..H files).
Thanks, Dave.