Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!caip!brl-adm!brl-smoke!smoke!$VK0%CLVM.BITNET@WISCVM.ARPA From: $VK0%CLVM.BITNET@WISCVM.ARPA (Valdis Kletnieks) Newsgroups: net.sources Subject: Re: unifdef processor Message-ID: <2533@brl-smoke.ARPA> Date: Thu, 24-Jul-86 11:32:01 EDT Article-I.D.: brl-smok.2533 Posted: Thu Jul 24 11:32:01 1986 Date-Received: Thu, 24-Jul-86 21:40:14 EDT Sender: news@brl-smoke.ARPA Lines: 54 Hmmm. I see in the last 3 or 4 days a NUMBER of people who claim that running a program through the C preprecessor will produce the desired results. 'Taint so, guys... Consider - #include #ifdef mach1 #define NBITS 16 /* this is a poor old PDP-11 */ #endif #ifdef mach2 #define NBITS 12 /* PDP-8 */ #endif #ifdef mach3 #define NBITS 32 /* a real machine like a Vax or such */ #endif .... ... for(i=0;i produces LOTS of line of blanks and other stuff.. (b) You end up with LOTS of 'magic numbers' like {8,12,16,32} hard-coded in the code. For REAL fun, try feeding kernel source that does a LOT of bit masking using #define'd masks through the preprocessor, and THEN try to understand what's going on. I thought that AVOIDING such stuff was the reason that the C-preprocessor was INVENTED. What the people were ASKING for here was something that would ONLY strip out the irrelevant code from stuff like the above, leaving only the 1 appropriate #define, and LEAVE THE REST OF THE CODE ALONE. Valdis Kletnieks Systems Programmer Educational Resources Center Clarkson University Potsdam, NY 13676 (315) 268-2292 BITNET: $VK0 at CLVM ARPA: $VK0%CLVM@WISCVM.ARPA (old style) $VK0%CLVM@WISCVM.WISC.EDU (new style) UUCP: {pur-ee,ccvaxa,sun}!gould!clutx!vk0 decvax!sii!trixie!gould!clutx!vk0 ICBM: 044N 40 075W 00