9fans archive / 2000 / 08 / 68 prev next
From: Douglas A. Gwyn <dagwyn@hom...>
Subject: Installing the updates
Date: Wed, 2 Aug 2000 09:53:55 GMT
rob pike wrote:
> To meet that goal, we had to break with the ANSI include rules.
I don't see why. The C standard does *not* say that
you *must* include any header multiple times; you
can enforce Plan9 programming discipline regardless
of whether headers have internal idempotency locks.
The presence or absence of such locks has no effect
on Plan9-style applications that #include every header
needed, once apiece in whatever the proper order is.
Indeed, the Plan9 header discipline imposes an
interdepency ordering upon the system headers,
such that e.g. <libsec.h> and <libmp.h> cannot
both define something that the other header needs,
which might otherwise be a natural thing to do.
It is nice that Plan9 programs don't individually
use #ifdefs and config, but really the use of
centrally-defined types and macros in a common
environment avoids such stuff. In effect, the
differences are factored out to a global level.
The reason for remaining #ifdefs in many actual
applications is that they have to work in many
environments that differ in much more radical ways
than any two instances of Plan9. There are ways
of factoring out the differences, and I generally
recommend them in the design phase, but most
applications are created by people who don't know
(or care) about all the ways other environments
differ from the one where they do their development,
and some other poor sap later on is stuck with
porting their code. Repackaging the whole thing
might not be feasible, so patching places where
problems crop up using #ifdefs is expedient.
(More work for the *next* poor sap.) It would be
nice if everybody had the experience and foresight
to design his code properly in the first place,
with all system dependencies isolated modularly,
but in the real world that seldom seems to happen.