Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mcnc!rti!dg_rtp!meissner From: meissner@dg_rtp.UUCP (Michael Meissner) Newsgroups: comp.lang.c Subject: Re: portability and standards Message-ID: <2166@dg_rtp.UUCP> Date: Sun, 21-Jun-87 13:32:59 EDT Article-I.D.: dg_rtp.2166 Posted: Sun Jun 21 13:32:59 1987 Date-Received: Mon, 22-Jun-87 06:57:42 EDT References: <2290@calmasd.GE.COM> <16939@cca.CCA.COM> <17198@amdcad.AMD.COM> Reply-To: meissner@dg_rtp.UUCP (Michael Meissner) Distribution: world Organization: Data General (Languages @ Research Triangle Park, NC.) Lines: 33 In article <17198@amdcad.AMD.COM> tim@amdcad.UUCP (Tim Olson) writes: /* nested comments removed */ > We tend to write our .h files (for global variables) something like: > > #ifdef GLOBAL > #define EX > #else > #define EX extern > > EX int foo, bar; > > Then, in one .c file which includes this .h file, we #define GLOBAL. > The external variables will be declared in all files, but defined only > in the file which #defines GLOBAL. This still has the problem that > explicit initialization cannot be done, but it is much more portable. I use a somewhat similar scheme that allows simple initializations: #ifndef GLOBAL #define GLOBAL extern #define INIT(x) #endif GLOBAL char *p INIT("initialization"); in the main program before the includes, I define: #define GLOBAL #define INIT(x) = x -- Michael Meissner, Data General Uucp: ...mcnc!rti!dg_rtp!meissner It is 11pm, do you know what your sendmail and uucico are doing?