Path: utzoo!attcan!uunet!mcvax!ukc!etive!lfcs!db From: db@lfcs.ed.ac.uk (Dave Berry) Newsgroups: comp.lang.c++ Subject: Re: goodbye cpp ??? Message-ID: <1106@etive.ed.ac.uk> Date: 28 Nov 88 17:37:09 GMT References: <6590072@hplsla.HP.COM> Sender: news@etive.ed.ac.uk Reply-To: db@lfcs.ed.ac.uk (Dave Berry) Organization: Laboratory for the Foundations of Computer Science, Edinburgh U Lines: 45 In article <6590072@hplsla.HP.COM> jima@hplsla.HP.COM (Jim Adcock) writes: >As we head towards parameterized classes, isn't it time to >start thinking about getting rid of cpp, and its associated >non-syntactic hacks? If what you want is to get rid of such "abuses" as #define BEGIN { #define Case break; case #define K *1024 a better way to do it would be to restrict the rhs of #defines in the C++PP to be complete expressions or declarations. Clearly the C++PP would have to diverge from the CPP to do this, and equally clearly there would have to be a compiler option to use the CPP instead, to retain compatibility with C. I put "abuses" in quotes as some people like the examples shown and some dislike them. If you still want to get rid of the preprocessor, one approach would be to persuade people to support each of the language extensions that would be needed, in turn, until people choose to stop using the preprocessor for anything (except conditional compilation?). I don't think you're likely to gain much support for an attempt to remove it by fiat; to do so you'd at least need to be sure you hadn't missed any desirable functionality. The current definition of C++ can't do half the things that the CPP can. For example, inline functions can't replace macros that have declarations or constant expressions on their rhs. An example of the latter is: #define CTRL(x) (x - 0100) ... case CTRL('A'): Not that I'd mind a bit more restriction on what the preprocessor could do -- just as long as I can still do all the things *I* want (semi ;-). BTW, I like the idea of a once-only include. Dave Berry, Laboratory for Foundations of Computer Science, Edinburgh. db%lfcs.ed.ac.uk@nss.cs.ucl.ac.uk!mcvax!ukc!lfcs!db