2011/4/10 Ruben Van Boxem <[email protected]>: > > Op 10 apr. 2011 19:05 schreef "James K Beard" <[email protected]> het > volgende: > >> >> Philosophies about how compilers should be build has gone through fads and >> phases. Originally, of course, compilers were built using macro assemblers, >> and such large programs in macro assembler almost inevitably have dependency >> and side-effect bugs that are almost impossible to find and fix without >> causing other subtle bugs, and of course macro assembly code of any size is >> notoriously difficult to maintain. At one point the ideal was to build all >> compilers in Pascal code, because of all the computer science built into the >> Pascal language, but in practice it didn’t work out because things like >> garbage collection and stack/heap management weren’t easily done in Pascal. >> Sometime in the early 1990’s most newer compilers were built in C, and these >> tended to be successful. But there is still a contingent of computer >> scientists that believe that the best compilers are written in their own >> language. >> >> >> >> The obvious advantage of building a compiler in its own language is that >> compiling itself is likely to test every single feature of that language. >> This cannot be as thorough as a well-developed test suite, and you must >> accept the limitations of each language in the building of its own compiler, >> e.g. stack/heap management in a Pascal compiler – and large Pascal programs >> are known to be particularly prolific stack and heap users and abusers. >> But, for a language such as C (or, C++?) it does seem a natural thing to do >> for a number of reasons. >> >> >> >> I would want to be careful about using C++ as the compiler language for >> two reasons, the higher cost of maintenance of C++ code and the fact that >> it’s not at all obvious what C++ brings to the table for compiler code. > > I believe you haven't met the phenomenon called LLVM/Clang. This is > full-fledged C++, used for just about anything from JIT to C/C++ > compilation. Note that I'm not saying a compiler has to be written in C++, I > never did. But it's not as daunting as you make believe. I was simply > pointing out to Kai that GCC is preparing for a limited transition to allow > a shallow subset of C++ (which is very strange and shows of little > understanding of what C++ is in my eyes; it's not an add-on to C, and sucks > if you were to use it that way, but that's my opinion on the matter), and > completely aside from that, allow bootstrapping the C++ parts of the > compiler as well. No philosophical argument in intended. > > Ruben >
Ruben, I am pretty aware of LLVM and clang. I remember the times when C++ compilers were nothing more then a preprocessor expressing c++ as C and the C code actual got compiled. But lucky we are, that those times are past. Nevertheless the C runtime is the base for most (if not even any) C++ runtime implementations nowaday, and therefore the bare minimal bootstrap language (as for gcc) is C. By the fact that a the C-runtime needs to be buidable even without a C++ compiler and existing runtime (like STL, C++ headers, etc), therefore is it an absolute an no-go to use in our runtime C++ libraries, which are depending on any feature provided by std C++ library (STL, base classes, and co). In some points it might be interesting to implement and export in a C-runtime (as for example VC's msvcrt does) a small set of c++ base-functions. But this means that those parts have to be written without any dependency to that what you would call a sane C++ environment. The msvcrt contains a lot of C++ generated code and even some C++ methods are exported (like new/delete operator implementation, exception-handling classes, etc). Therefore, as gcc allows a bare C bootstrap (and we have to support that) without a c++ compiler, c++ libraries and code in our standard runtime are nothing to be considered. Kai ------------------------------------------------------------------------------ Xperia(TM) PLAY It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games. http://p.sf.net/sfu/verizon-sfdev _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
