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(a)kjorling.se>
wrote:
On 3 Jan 2017 13:05 -0800, from
charles.unix.pro(a)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(a)kjorling.se
“People who think they know everything really annoy
those of us who know we don’t.” (Bjarne Stroustrup)