Newsgroups: comp.lang.c++
Path: utzoo!henry
From: henry@utzoo.uucp (Henry Spencer)
Subject: Re: goodbye cpp ??? (macros vs. inline functions)
Message-ID: <1988Nov27.011355.29290@utzoo.uucp>
Organization: U of Toronto Zoology
References: <6590072@hplsla.HP.COM> <1757@dataio.Data-IO.COM> <3637@pt.cs.cmu.edu> <1304@cod.NOSC.MIL> <12903@duke.cs.duke.edu> <265@aber-cs.UUCP>
Date: Sun, 27 Nov 88 01:13:55 GMT

In article <265@aber-cs.UUCP> pcg@cs.aber.ac.uk (Piercarlo Grandi) writes:
>On the other hand I do really believe that cpp in C++ is not that
>useful; #include's should be done with import/export...

In other words, with new constructs that will have to resemble #include
in many ways, except that they will undoubtedly be more complex.  Why bother?
Is there some specific benefit, apart from the change in syntax?  Please
remember that the new scheme will have to be one that can cope with search
paths, separations between projects, standard/optional/local/project/program
libraries, debugging vs compile-for-production, etc. -- simply having the
construct always look in one standard place for things to import is not
nearly good enough.  Only toy compilers always use the same libraries for
all compilations.

>...definitions can be done with inlines and consts...

Not all definitions, although to some extent it depends on where you draw
the line between "definitions" and "syntax extensions".

> ...conditional compilation can be done most often by a suitable constant
>expression in a if...

How do you make this work for declarations?  (I made the same blunder long
ago.)

>as to syntax extensions, I think something like ML/1 would be the
>ideal thing here.

"Ideal" in what sense?  Certainly not from an implementor's point of view.
Or from the viewpoint of a user who has to understand already-written code.

The preprocessor may be ugly, but at least it is (apart from some of the
fine points of macro expansion in draft-ANSI C) relatively simple and easy
to understand.  (Programs that exploit it in fancy ways can be cryptic, but
programs that exploit more complex mechanisms in fancy ways will be worse.)
That is not a trivial virtue.
-- 
Sendmail is a bug,             |     Henry Spencer at U of Toronto Zoology
not a feature.                 | uunet!attcan!utzoo!henry henry@zoo.toronto.edu
