Xref: utzoo comp.lang.c:36531 comp.software-eng:4924 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!ucsd!mvb.saic.com!ncr-sd!serene!rfarris From: rfarris@rfengr.com (Rick Farris) Newsgroups: comp.lang.c,comp.software-eng Subject: Source File Organization Message-ID: <1991Feb26.045242.23453@rfengr.com> Date: 26 Feb 91 04:52:42 GMT Organization: RF Engineering, Del Mar, California Lines: 33 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@rfengr.com ...!ucsd!serene!rfarris serenity bbs 259-7757 Brought to you by Super Global Mega Corp .com