Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site cmu-cs-k.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!rochester!cmu-cs-pt!cmu-cs-k!tim From: tim@cmu-cs-k.ARPA (Tim Maroney) Newsgroups: net.lang.c Subject: Re: Can #define `token-string' be empty? Message-ID: <282@cmu-cs-k.ARPA> Date: Thu, 21-Feb-85 14:42:07 EST Article-I.D.: cmu-cs-k.282 Posted: Thu Feb 21 14:42:07 1985 Date-Received: Tue, 26-Feb-85 06:12:01 EST References: <151@cci-bdc.UUCP> Organization: Carnegie-Mellon University, CS/RI Lines: 36 > > Is > > #define X > > valid, i.e., can the `token-string' mentioned on page 207 of K&R be empty? > > Yes. the default value of X is 1. > > larry... Wrong. The default value of X is nothing. Any instances of the token X will be removed from the source file before parsing. This is frequently used to make include files do double duty. At the start of the include file, put #ifndef EXTERN #define EXTERN extern #endif Then the include file should contain declaratons of this form: EXTERN int global_int; EXTERN struct marsupial *wombat; Including the file normally causes these to be external declarations, that is, no space is allocated for the variables. Then, in the source file where you want to actually have the variables' storage allocated, you just say #define EXTERN #include "whatever.h" -=- Tim Maroney, Carnegie-Mellon University Computation Center ARPA: Tim.Maroney@CMU-CS-K uucp: seismo!cmu-cs-k!tim CompuServe: 74176,1360 audio: shout "Hey, Tim!" "Remember all ye that existence is pure joy; that all the sorrows are but as shadows; they pass & are done; but there is that which remains." Liber AL, II:9.