9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "rob pike" <rob@plan9.bell-labs.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Installing the updates
Date: Tue,  1 Aug 2000 09:35:52 -0400	[thread overview]
Message-ID: <200008011335.JAA17292@cse.psu.edu> (raw)

Perhaps I should explain better.

The only tenable argument in favor of allowing #include files to
include #include files is that a lot of software does that, so
permitting it makes software easy to port.  That is, I'm sure, why the
ANSI C committee accepted it: it's standard practice.

Nonetheless, it's a cop-out.  It's a terrible practice that leads to
n-squared inclusion of files, painful overwork by the C preprocessor,
and a bad name for the idea of #include files in the first place.

When designing the Plan 9 environment, we started with ANSI C for the
language.  Other than a couple of extensions to the language proper,
we took ANSI C at face value.  The library was also accepted pretty
much as is, with a few minor differences.  However, the C preprocessor
was unacceptable to us because a) it was very complex; b) it had lots
of new stuff designed by committee, a recipe for disaster; and c) most
of the new stuff encouraged conditional compilation and other horrors
we were trying to get away from.

Our idea was to build a portable system, one whose software could be
compiled without change - and that means without conditional
compilation, since you always have to change the #ifdefs when you
port; that is the very definition of config - as we changed
architectures.  Just architectures, not operating systems: we did not
expect Plan 9 programs to be compilable on Unix systems, but we did
expect a Plan 9 program that runs on a 386 to work on a SPARC, say,
without change, just by compiling it.

To meet that goal, we had to break with the ANSI include rules.

To import external code, we (well, Howard) built a fairly strict ANSI
C/POSIX environment that follows all the rules, including getting the
libraries and C preprocessors to have standard behavior.  If you want
to import code, that's the minimum effort path.

But if you want to build Plan 9 code, part of the environment is that
#include files don't #include each other.  That is just the way it
works, like not running X or using mk instead of make or setting
objtype=mips to build for the Mips.

In short, the argument that existing software #includes like that so
Plan 9 should is bogus, *because Plan 9 software does not*.

Plan 9 is a different environment, but it's different for a reason.
In the case of #include files, it's to make software easier to port
and simpler to maintain.  Within its own, admittedly smaller, world,
it succeeds.  Show me another system that builds all its software on
multiple architectures without #ifdefs or config.  Show me another
system where I can compile on a SPARC, link on a 386, and run on a
Mips.  Show me another system where I can update an application for
every architecture by typing the equivalent of
	mk installall
I'd love to hear of it!  But in this #ifdef, config-riddled world I
don't think it exists.

-rob



             reply	other threads:[~2000-08-01 13:35 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-08-01 13:35 rob pike [this message]
2000-08-01 18:34 ` Greg Hudson
2000-08-02  9:53 ` Douglas A. Gwyn
  -- strict thread matches above, loose matches on Subject: below --
2000-08-02  9:47 forsyth
2000-08-02  9:52 ` Boyd Roberts
2000-08-01 17:06 Russ Cox
2000-08-02  8:32 ` Bruce G. Stewart
2000-08-01 16:27 rob pike
2000-08-02 10:53 ` Ralph Corderoy
2000-08-01 16:26 rob pike
2000-08-02 21:49 ` Steve Simon
2000-08-01 13:06 rob pike
2000-08-01 13:10 ` Lucio De Re
2000-08-01 12:55 rob pike
2000-08-02  9:39 ` Douglas A. Gwyn
2000-08-01  6:04 Russ Cox
2000-08-01  5:42 Russ Cox
2000-07-31 17:09 Russ Cox
2000-07-31 15:57 jmk
2000-07-31 15:15 rob pike
2000-08-01  8:53 ` Douglas A. Gwyn
2000-08-01 12:12   ` Howard Trickey
2000-08-02  9:11     ` Douglas A. Gwyn
2000-08-01 14:31   ` Ralph Corderoy
2000-08-01 16:03     ` Greg Hudson
2000-08-01 16:32       ` James A. Robinson
2000-08-01 17:05         ` James A. Robinson
2000-08-02  9:39       ` Douglas A. Gwyn
2000-08-02  9:11     ` Douglas A. Gwyn
2000-08-03 14:51     ` ozan s. yigit
     [not found] <djhender@telusplanet.net>
2000-07-31 14:53 ` Doug Henderson
2000-07-31 17:38   ` Scott Schwartz
2000-07-31 20:10     ` Steve Simon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200008011335.JAA17292@cse.psu.edu \
    --to=rob@plan9.bell-labs.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).