From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 20 Jul 93 15:46:49 GMT From: cis.ohio-state.edu!math.ohio-state.edu!darwin.sura.net!newsserver.jvnc.ne t!louie!balin.cis.udel.edu!carroll@ucbvax.Berkeley.EDU (Mark C. Carroll) Subject: Re: Admiral Tuttle (Should be ...) Revisited Message-ID: <1993Jul20.154649.27200@udel.edu> List-Id: In article <9307140635.aa13529@dsc.blm.gov> cjames@DSC.BLM.GOV (Colin James 062 1) writes: > > >The assertion that "oracorp.com" is Oracle is of course mistaken, >and thank you all for private mail to that effect. > >Mark C Carroll, and others, assert that C++ is not a pre-processor >and that C does not necessarily produce faster running code. In >my opinion they are misinformed because the original definition >and intent of C++ was as a pre-processor to generate C code (not >assembler or machine code). If C++ has become something else then >it should have a new name such as C+++ for non-pre-processor >implementations on hardware platforms such as PC's. I want to respond to two points in the above, seperately. First of all: I think that the issue of C++ as preprocessor or compiler is entirely independent of whether C code runs faster or not. Regardless of how C++ is compiled, _any_ piece of C code can be written in C++ (sometimes it will require extra casts, but the basic code is identical), and will generate _identical_ code to C - either because (1) the compiler outputs the code in standard C, so it generates the same output code for the same input code; or (2) the compiler generates true object code, but because the operations being performed are identical, and the semantic information available is identical, equivalent object code will be produced. (If the same code generator is used, as in the GNU g++ compiler, then this will result in identical code.) Second: what is the difference between a compiler and a preprocessor. You're calling C++ a preprocessor, because what it outputs is C, rather than assembly language. I argue that that is *not* the difference between a preprocessor and a compiler: the difference is that a preprocessor does strict textual replacement without regard for semantics, but a compiler does semantic analysis and performs a translation from a source to an object based on the semantic analysis. By that definition, C++ is, and always was a compiler. If you define a compiler as something that produces assembly code, then I think you're using a definition which argues against reality: is the DEC Scheme-to-C compiler really just a preprocessor? Is the Sather language from Berkeley really just a preprocessor? Both take languages fundamentally different from C as input, and generate standard C as a generic intermediate language, and then use the system C compiler as a back end. C++ is just like those two, except that the source is much closer to the intermediate language. -- || Mark Craig Carroll: ||"Don't try to tell me there's no reason || CIS Grad, Univ of Delaware || for any moment in time, for every memory || PGP key available by finger || of mine. Those years are lines of color on || carroll@udel.edu || my face, the past is warpaint"-Happy Rhodes