$VK0%CLVM.BITNET@WISCVM.ARPA (Valdis Kletnieks) (07/24/86)
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 <stdio.h> #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<NBITS;i++) { /* some code here */ } ..... .... Feed this to your C-preprocessor. (a) That <stdio.h> 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