Source File Organization
Rick Farris
rfarris at rfengr.com
Tue Feb 26 15:52:42 AEST 1991
I have a problem that I'm sure has been solved in the C
language before; would someone point me in the right
direction?
I have an enumerated type:
typedef enum { A, B, C, D } CMD;
and a corresponding array of ascii representations :
char ltrs[] = { 'A', 'B', 'C', 'D' };
used for printing and other various purposes. (Of course
the real problem is much more complicated than this, but
this simple example is sufficient for illustrative
purposes.)
My problem is: How do I keep the darn things in sync?
Suppose I add a new CMD, "Z", is there any way to ensure
that ltrs[] is updated?
The problem is exacerbated by the fact that the CMD enum,
being a typedef, is in a header file that is included in
many places. Since ltrs[] is an instantiated variable, it
*can't* live in the same place. Where should it live?
Thanks!
--
Rick Farris RF Engineering POB M Del Mar, CA 92014 voice (619) 259-6793
rfarris at rfengr.com ...!ucsd!serene!rfarris serenity bbs 259-7757
More information about the Comp.lang.c
mailing list