From mboxrd@z Thu Jan 1 00:00:00 1970 From: lyndon@orthanc.ca (Lyndon Nerenberg) Date: Tue, 3 Jan 2017 13:39:40 -0800 Subject: [TUHS] Mac OS X is Unix In-Reply-To: <201701032019.v03KJ8oq028944@tahoe.cs.Dartmouth.EDU> References: <201701032019.v03KJ8oq028944@tahoe.cs.Dartmouth.EDU> Message-ID: <81B054A7-A361-49F4-B974-51370500D60D@orthanc.ca> > #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().