The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Larry McVoy <lm@mcvoy.com>
To: Rob Pike <robpike@gmail.com>
Cc: TUHS main list <tuhs@minnie.tuhs.org>
Subject: Re: [TUHS] run commands at login in v6 and stty
Date: Sun, 27 Feb 2022 07:01:55 -0800	[thread overview]
Message-ID: <20220227150155.GG21168@mcvoy.com> (raw)
In-Reply-To: <CAKzdPgwuDGBThBH9c+-wg-eCaNxC5ZR3b6FSDoD-EFX5PiKwSg@mail.gmail.com>

On Sun, Feb 27, 2022 at 10:12:39AM +1100, Rob Pike wrote:
> Cpp was definitely in v6, and I'm pretty sure it was in earlier editions.
> The first pass of the C compiler would invoke it if the first byte of the
> source file was a '#'. However, the early version only did #define and
> #include. It was rewritten for v7, I believe, introducing the catastrophe
> of #ifdef, while the existential horror of #if was later still, foisted on
> us by someone not in Research.
> 
> -rob


As someone who has lived through a lot of #if / #ifdef et al, I've got
mixed feelings.  SGI definitely abused it, Dave Cutler was asked to
make NT work on MIPS and was given the IRIX kernel source as a guide.
That source was riddled with #ifdef <something>WAR where "WAR" stood for
"work around" (I might have the details wrong but definitely have the
idea correct).  All of those work arounds were kernel code that had to
be different because various MIPS chips had bugs.

Cutler's response was "Send me the kernel code when you have MIPS chips
that actually work".  He was disgusted and I don't blame him.

On the other hand, I grew up in the era that X11 was sort of new, all the
vendors had their own windowing system (Sunview comes to mind), and while
they all had something to be said for them (the Sunview API was really
nice), they all were different.  So people like me carried around an X11
source tree and built it on whatever platform I happened to be running
on today (I was a contractor early on, worked on lots of different boxes).

The X11 tree was a heavily ifdef-ed.  And it needed to be, I don't have
an answer as to how you would reuse all that code on different hardware
in a better way.  Yep, ugly, but having N copies of the same code,
all almost the same but a little different, yeah, that's a formula for
having bugs fixed in one of those copies but not the others.

So while I understand (I think) Rob's distaste for #ifdef, I've been
very grateful for it when I needed it.  I ran ctwm on X11 for decades
and everything "just worked" on Suns, SGIs, PowerPC, PARISC, etc.

--lm

  parent reply	other threads:[~2022-02-27 15:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-26 20:39 Will Senn
2022-02-26 21:03 ` Michael Kjörling
2022-02-26 22:49 ` Clem Cole
2022-02-26 23:12   ` Rob Pike
2022-02-27  0:46     ` Clem Cole
2022-02-27 15:01     ` Larry McVoy [this message]
2022-02-27 17:10       ` Clem Cole
2022-02-26 21:45 Brian Walden
2022-02-26 22:16 ` Rob Pike
2022-02-27 20:32 ` Sven Mascheck
2022-02-27  7:48 Noel Chiappa
2022-02-28  1:04 Douglas McIlroy
2022-02-28  7:22 ` Rob Pike
2022-02-28 14:07   ` Larry McVoy
2022-02-28 18:47     ` Dan Cross
2022-02-28 19:25       ` Dan Cross
2022-02-28 21:25         ` markus schnalke
2022-02-28 19:26       ` Clem Cole
2022-02-28 20:03         ` Adam Thornton
2022-02-28 18:18 ` Warner Losh

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=20220227150155.GG21168@mcvoy.com \
    --to=lm@mcvoy.com \
    --cc=robpike@gmail.com \
    --cc=tuhs@minnie.tuhs.org \
    /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).