The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: lyndon@orthanc.ca (Lyndon Nerenberg)
Subject: [TUHS] Mac OS X is Unix
Date: Tue, 3 Jan 2017 13:39:40 -0800	[thread overview]
Message-ID: <81B054A7-A361-49F4-B974-51370500D60D@orthanc.ca> (raw)
In-Reply-To: <201701032019.v03KJ8oq028944@tahoe.cs.Dartmouth.EDU>

> #ifdef LINUX
> 	linux code
> #else
> 	default unix code
> #endif
> 
> instead of the much cleaner
> 
> 	if(LINUX)
> 		linux code
> 	else
> 		default unix code
> 
> In early days the latter would have cluttered precious memory
> with unfreachable code, but now we have optimizing compilers
> that will excise the useless branch just as effectively as cpp.

Plan 9 refreshingly evicted this nonsense from the native compilers (mostly) and the code base.[1]

I remember reading a Usenet post from the mid-late 80s that showed a roughly 40 line sequence of #foo hell from some bit of SVRx code.  There wasn't a single line of actual C there.  That it involved conditionalizing around the tty/termio drivers and some machine-specific ioctl goop ... well, let's not go *there*.

It might have been posted as an example for the Obfuscated C Contest.  It certainly could have won. (Assuming an entry without any actual C code was eligible.  Vague memories say anything that survived 'cc -o foo xxx.c [...]' was allowed.)

--lyndon

[1] Eliminating many binary APIs -- e.g. ioctl() -- in favour of textual ones, was a stroke of genius.  Not just with fileservers (/net et al), but also with things like dial().


  parent reply	other threads:[~2017-01-03 21:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-03 20:19 Doug McIlroy
2017-01-03 21:05 ` Charles Anthony
2017-01-03 21:33   ` [TUHS] When was #if introduced in C? (was: Re: Mac OS X is Unix) Michael Kjörling
2017-01-03 21:53     ` Robert Swierczek
2017-01-03 21:57       ` Clem Cole
2017-01-03 21:56     ` Clem Cole
2017-01-03 21:35 ` [TUHS] Mac OS X is Unix Clem Cole
2017-01-03 22:10   ` Lyndon Nerenberg
2017-01-03 21:39 ` Lyndon Nerenberg [this message]
2017-01-03 22:12   ` ron minnich
2017-01-03 23:39     ` Tim Bradshaw
2017-01-04  0:12       ` ron minnich
2017-01-04  9:11         ` Tim Bradshaw
2017-01-04 10:04           ` Álvaro Jurado
2017-01-04  0:13 ` Steve Johnson
2017-01-04  3:50 ` Dan Cross
2017-01-04 12:26   ` Tim Bradshaw
2017-01-04 13:49     ` Random832
2017-01-04 15:02     ` Dan Cross
2017-01-04 17:14       ` tfb

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=81B054A7-A361-49F4-B974-51370500D60D@orthanc.ca \
    --to=lyndon@orthanc.ca \
    /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).