Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbosgd!ihnp4!bentley!kwh From: kwh@bentley.UUCP (KW Heuer) Newsgroups: net.lang.c Subject: Re: builtins and automatic defines Message-ID: <846@bentley.UUCP> Date: Thu, 22-May-86 18:31:13 EDT Article-I.D.: bentley.846 Posted: Thu May 22 18:31:13 1986 Date-Received: Sun, 25-May-86 13:06:49 EDT References: <1243@utcs.uucp> Organization: AT&T Bell Laboratories, Liberty Corner Lines: 36 Keywords: #exclude In article <1243@utcs.uucp> utcs!flaps (Alan J Rosenthal) writes: >In article <816@bentley.UUCP> kwh@bentley.UUCP (KW Heuer) writes: >>I wonder if perhaps (and ) should be included by >>default, with an explicit "#exclude" to disable. (Cf. "#undef".) Probably >>tricky to implement -- don't do the automatic "#include" until checking for >>"#exclude", which must be at the top of the file (after whitespace)? > >Why bother? This would be very complicated and lead to many mistakes due >to an unclear definition of whitespace or whatever. It doesn't seem all that complicated to me, and probably seems simpler to the neophyte who doesn't understand why he gets "stderr undefined" when his program was working fine earlier. The mistakes could be easily caught by cpp: "#exclude must be at top of file". I meant for "whitespace" to include comments, otherwise I think it's quite clear (when restricted to the set of characters that can legally appear in a C program). >I have a file called "beginc", it's a shellscript, and it creates a file [which contains several #include's and #define's and the start of main()] >and then puts you in $EDITOR on the file. This approach is much better >than any #exclude op. It's more easily disabled or modified because you >don't have the reverse situation of deleting things by adding in lines. Perhaps. We already have the "delete by adding" situation with #undef, though the analogy isn't perfect (you can't completely cancel an #include, which is why #exclude would have to be first). On a related note, I've always despised the automatic cpp builtins (such as "#define unix 1" on UNIX(R) systems), because it effectively creates a new reserved word for each possible operating system, machine, etc. that your program might be compiled on. Older versions got around this by making the builtin definition be "#define unix unix", with a special kludge to prevent infinite recursion. I think the "who am i" testing should not use the same namespace as the macros. Karl W. Z. Heuer (ihnp4!bentley!kwh), The Walking Lint