Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!genrad!mit-eddie!godot!ima!ISM780B!jim From: jim@ISM780B.UUCP Newsgroups: net.lang.c Subject: Re: strings in defs.h force recompiles w Message-ID: <112@ISM780B.UUCP> Date: Sat, 3-Nov-84 12:41:16 EST Article-I.D.: ISM780B.112 Posted: Sat Nov 3 12:41:16 1984 Date-Received: Sun, 4-Nov-84 04:46:15 EST Lines: 29 Nf-ID: #R:oliveb:-20600:ISM780B:25500063:000:1019 Nf-From: ISM780B!jim Nov 1 19:18:00 1984 I have a different approach, which avoids the problem of having to have def.h track strings.c, and of having the name of the string separate from its text. strings.c looks like char NEWS_VERSION[] = "B 2.10.2 9/5/84"; char DFLTSUB[] = "general,all.general"; char TMAIL[] = "/usr/ucb/Mail"; char ADMSUB[] = "general,all.announce"; char PAGE[] = "/usr/ucb/more"; char NOTIFY[] = "usenet"; char DFTXMIT[] = "uux - -r -z %s!rnews < %s"; char UXMIT[] = "uux -r -z -c %s!rnews '<' %s"; char DFTEDITOR[] = "vi"; Either declare these in defs.h, extern char NEWS_VERSION[], DFLTSUB[], ... or only where needed. The latter would avoid remaking everything whenever you add or delete a string. One thing to watch out for in this scheme or the strings[n] scheme is that you can't take sizeof the strings. You also cannot use them as initializers. But for common use as error formats or pathnames, this works pretty well. -- Jim Balter, INTERACTIVE Systems (ima!jim)