Path: utzoo!attcan!uunet!mailrus!tut.cis.ohio-state.edu!snorkelwacker!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: extern Message-ID: <17037@haddock.ima.isc.com> Date: 6 Jul 90 20:14:23 GMT References: <111254@linus.mitre.org> <910@bjcong.bj.co.uk> <277@taumet.com> <16994@haddock.ima.isc.com> <1990Jul5.044045.1534@acc.stolaf.edu> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 23 In article <1990Jul5.044045.1534@acc.stolaf.edu> hannum@haydn.psu.edu (Charles Hannum) writes: >In article <16994@haddock.ima.isc.com> karl@haddock.ima.isc.com (Karl Heuer) writes: >>[Rather than the `#define EXTERN' hack, many of us prefer to use `extern' in >>the header and a defining instance in one source file, which also includes >>the same header. This] is also completely portable, doesn't require >>preprocessor games, and allows the objects to have initializers ... [and] >>you can't get them out of sync. >Some of us also find your method grotesque, because we have to alter the >definition in *two* places rather than one if we change it. If you change something as fundamental as the type of an object, you probably have to change every reference in *every* source file. If it's sufficiently abstract that you don't, then use a typedef, and change only the header. >"... preprocessor games, ..."? It's not a game. It's a perfectly ligitimate >use of the C preprocessor. If we weren't supposed to use it, it wouldn't be >included (based C's minimalist philosophy). This argument applies equally well to all sorts of preprocessor abuse, all strictly legal C. Sorry, I don't buy it. Karl W. Z. Heuer (karl@kelp.ima.isc.com or ima!kelp!karl), The Walking Lint