The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: rminnich@gmail.com (ron minnich)
Subject: [TUHS] Ifdef hell
Date: Wed, 04 Jan 2017 16:13:51 +0000	[thread overview]
Message-ID: <CAP6exYJTS72qvZkFzm3xCse+XGUCky12MV4FFL5X4OVztAA1eQ@mail.gmail.com> (raw)
In-Reply-To: <D7D08741-CA9F-4941-B311-0692BF436510@kdbarto.org>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2317 bytes --]

I forgot another good example of portability *mostly* minus ifdef, mainly
plan9ports. This is the full set of plan 9 tools, including graphics tools
like the rio window manager, and it's pretty much ifdef-free.

I just did a quick grep for ifdef and it's basically
ifdef cplusplus
in some include files, which seems unavoidable nowadays, and of course
anything imported from elsewhere has the usual pile of ifdefs.

the configure script is just
echo read the README file

same for Makefile.

To build, you just run an INSTALL script which builds it all. Compilers are
fast. Makefile errors are avoided by just building it all, each time.

Would that the gnubin tools had learned these lessons.



On Wed, Jan 4, 2017 at 6:52 AM David <david at kdbarto.org> wrote:

> From: "Doug McIlroy" <doug at cs.dartmouth.edu>
> Subject:Re: [TUHS] Mac OS X is Unix
>
> > keeping the code I work on portable between Linux and the Mac requires
> > more than a bit of ‘ifdef’ hell.
>
> | Curmudgeonly comment: I bristle at the coupling of "ifdef” and
> "portable".
> | Ifdefs that adjust code for different systems are prima facie
> | evidence of NON-portability. I'll buy "configurable" as a descriptor
> | for such ifdef'ed code, but not "portable".
>
> | <snip>
>
> | "Ifdef hell" is a fitting image for what has to be one of
> | Unix's least felicitous contributions to computing. Down
> | with ifdef!
> | Doug
>
> Doug makes a very good point about ifdef hell. Though I’d claim that it
> isn’t even “configurable” at some level.
>
> Several years ago I was working at Megatek, a graphics h/w vendor. We were
> porting the X11 suite to various new boards at the rate of about 1 a week
> it seemed. Needless to say the code became such a mishmash of ifdef’s that
> you couldn’t figure out what some functions did any longer. You just hoped
> and prayed that your patch worked properly on the various hardware you were
> targeting and didn’t break it for anyone else. You ran the unit tests, if
> they passed you pushed your change and ran an hid under a rock for a while
> until you were sure it was safe to come out again.
>
>         David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20170104/9102da4a/attachment.html>


      reply	other threads:[~2017-01-04 16:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-04 14:51 David
2017-01-04 16:13 ` ron minnich [this message]

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=CAP6exYJTS72qvZkFzm3xCse+XGUCky12MV4FFL5X4OVztAA1eQ@mail.gmail.com \
    --to=rminnich@gmail.com \
    /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).