The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: clemc@ccc.com (Clem Cole)
Subject: [TUHS] When was #if introduced in C? (was: Re: Mac OS X is Unix)
Date: Tue, 3 Jan 2017 16:56:38 -0500	[thread overview]
Message-ID: <CAC20D2MJAHSAtfbYR+dXWg=9nKmkuj7bJ3r9EHrV5SoPRq7Uiw@mail.gmail.com> (raw)
In-Reply-To: <20170103213331.GN31772@yeono.kjorling.se>

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

The cpp.c code in 6th edition only supported #ifdef.   IIRC the v7 cpp had
#if, but it may have been in typesetter C.   I think mashey needed it for
SCCS (I don't have sources easy to look at PWB 1.0), so my guess is it was
developed during that transition.  The key is that  PWB 1.0 was a v6++
system.   UNIX/TS and later V7 had the newer kernel.   PWB 2.0 was based on
that one.    The typesetter compiler was developed in parallel to those
projects, which also put constraints on the language.

Clem

On Tue, Jan 3, 2017 at 4:33 PM, Michael Kjörling <michael at kjorling.se>
wrote:

> On 3 Jan 2017 13:05 -0800, from charles.unix.pro at gmail.com (Charles
> Anthony):
> > I was compiling on a 32 bit int machine; the compiler flagged the '1u <<
> > 60' as a fatal error due to the size of the shift -- on this compiler the
> > expression evaluator was running before the dead code remover.
>
> That was my thought too; the only way to guarantee that the code is
> removed before the compiler sees it is to do so through the
> preprocessor, thus #ifdef.
>
> Of course, #ifdef is rather limited. The #if preprocessor directive is
> more generic, but still significantly less versatile than the if()
> language keyword.
>
> Which makes me curious... Does anyone here happen to know when #if was
> introduced in C? I suspect #ifdef came earlier simply by virtue of
> being (at least to a naiive first approximation) far easier to
> implement, as all that would be required would be to look at the macro
> expansion table (already required by #define) and see if that
> particular name had previously been #defined, as opposed to actually
> evaluating an expression.
>
> --
> Michael Kjörling • https://michael.kjorling.se • michael at kjorling.se
>                  “People who think they know everything really annoy
>                  those of us who know we don’t.” (Bjarne Stroustrup)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20170103/0feb52a9/attachment.html>


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

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-03 20:19 [TUHS] Mac OS X is Unix 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 [this message]
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
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='CAC20D2MJAHSAtfbYR+dXWg=9nKmkuj7bJ3r9EHrV5SoPRq7Uiw@mail.gmail.com' \
    --to=clemc@ccc.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).