Path: utzoo!mnetor!uunet!husc6!bloom-beacon!gatech!uflorida!codas!mtune!mtgzz!drutx!clive From: clive@drutx.ATT.COM (Clive Steward) Newsgroups: comp.sys.mac Subject: Re: LightSpeed C, and C++ (what the compiler's about) Message-ID: <6894@drutx.ATT.COM> Date: 5 Mar 88 21:47:30 GMT References: <702@hqda-ai.UUCP> Organization: resident visitor Lines: 47 From article <702@hqda-ai.UUCP>, by arbaugh@hqda-ai.UUCP (Bill Arbaugh): > In article <76000138@uiucdcsp>, gillies@uiucdcsp.cs.uiuc.edu writes: >> >> I believe that C++ was designed so it could be implemented with a >> preprocessor (a more sophisticated proprocessor than M4, which brings >> #include and #define to C programming). > > The C++ by AT&T is somewhat like a preprocessor, but it also plays > with the objects upon exit and etc. Well, as I explained before, it's not so much to me, as a consultant. But I think that if you have a look at what the C++ compiler really does, you will be more than willing to call it a compiler. If you can get a look at source, you'll be the more sure. The size is about two times the size of the old C compiler, on Unix. This compiler implements all of the features of C++, which is a very large piece of work indeed. The result is some complex standard C, emitted as an intermediate level language. Any error reporting to the user comes straight from the C++ compiler; it passes on all constructs, including the old C ones. Once the C++ compile is successful, the old C compiler is used to reduce the ILL to assembler, which is assembled, and probably then linked for your executable. This makes the C++ compilation system pretty portable. I suppose the confusion comes from people compiling a small simple program, and observing that a dump of the ILL looks recognizably close to the original. Doesn't mean it always does, or that it was a simple matter to arrive at that place. That it's close at all, is a measure of the efficiency of the C++ implementation (and the abilities of the compiler), and its forming up of the desired object, overload, etc. relationships. Two other points. Old C doesn't use m4, it uses the cpp, a much simpler-minded tool. And yes, C++ in present form does play with the object code after the C compilation. The reason is that static constructors have to be initialized, and it's difficult to arrange a way for this to be done without the user worrying about it, when as usual there are many compiled files. So there's an extra editing step on the link module which ties all the constructors into a linked list to be actuated just before the user's main () routine executes. Clive Steward