extern
Karl Heuer
karl at haddock.ima.isc.com
Sat Jul 7 06:14:23 AEST 1990
In article <1990Jul5.044045.1534 at acc.stolaf.edu> hannum at haydn.psu.edu (Charles Hannum) writes:
>In article <16994 at haddock.ima.isc.com> karl at 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 at kelp.ima.isc.com or ima!kelp!karl), The Walking Lint
More information about the Comp.lang.c
mailing list