Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site bunker.UUCP Path: utzoo!linus!decvax!ittvax!bunker!garys From: garys@bunker.UUCP (Gary M. Samuelson) Newsgroups: net.lang.c Subject: Re: strings in defs.h force recompiles when changed. Message-ID: <606@bunker.UUCP> Date: Thu, 1-Nov-84 13:36:23 EST Article-I.D.: bunker.606 Posted: Thu Nov 1 13:36:23 1984 Date-Received: Sat, 3-Nov-84 05:22:59 EST References: <206@oliveb.UUCP> Organization: Bunker Ramo, Trumbull Ct Lines: 46 Jerry Aguirre doesn't like > file defs.h: > #define NEWS_VERSION "B 2.10.2 9/5/84" > #define DFLTSUB "general,all.general" > ... (and I agree with his reasons), and suggests two files, defs.h and strings.c, where strings.c defines an array of pointers to strings such as: > char *strings[] = { > "B 2.10.2 9/5/84", > "general,all.general", > ... > }; > > And the defs.h file now looks like: > extern char *strings[]; > #define NEWS_VERSION strings[0] > #define DFLTSUB strings[1] > ... I suggest instead a defs.h with entries such as: extern char *NEWS_VERSION; and a strings.c file with char *NEWS_VERSION = "B 2.10.2 9/5/84"; Advantages: 1. The order in which strings appear is not important. 2. The name of the string is meaningful to symbolic debuggers. 3. 'lint' can tell if strings are being defined but not used. 4. Only one copy of each string. 5. Changing a string doesn't force recompilation of every file which includes defs.h. (the last two advantages are shared by Jerry's model). Disadvantages: ?? If there were any, I would be the first to admit it :-) Gary Samuelson bunker!garys