How is gcc written in c




















However, the majority seems to be pleased with the changes. Only time will tell what new benefits or problems will arise. I am not a fan of openat , but maybe it can be used for GCC. The typical response is, why not just declare the destructor virtual? But we do not always have a choice about what goes into header files we get from others. A bug has been open on this for a long time: an easy fix would be to complain only when the destructor is called in a polymorphic context.

Another rule echoed in Google's much sillier standard forbids any use of exceptions. That can be defensible in a program that started out as C. What most of competent programmers overlook is that, the next person may not have all the skills, so it should be as simple and straightforward as possible. As for using exceptions it is more of a policy I think, either all code should be exception-aware or not.

Then probably the person who initially put together that standard did not like them maybe they take too much of the code real-state and look ugly, maybe she thinks they are just glorified goto statements, maybe exceptions should never cross the shared library for any reason.

While the case while you inherit a header is very real, one could argue about that problem with a LOT of warnings. I think it is reasonable to have it wired in to -W with an option to disable it on a per header basis in general, for warnings, you want to investigate and potentially disable them for a particular case You'd force people to bootstrap GCC 4. If we want people to use the GNU compiler instead of their system compiler then the barrier for entry can't be too high.

This would make a good contest. The coding standard they established for GCC looks highly specific to the legacy codebase they are building on. It's not useful as a general guideline. User: Password:. Benefits for LWN subscribers The primary benefit from subscribing to LWN is helping to keep us publishing, but, beyond that, subscribers get immediate access to all site content and access to a number of extra site features.

March 13, This article was contributed by Linda Jacobson. As C does not have any means of reflection [ It's a lot of work tree extends in all three Frontends, middle-end and backends. For a simple project, openat won't help much, but in a project with a hundred -I lines, searching through the -I directories to find each header can have significant overhead. Processing the header will always be more expensive than open or openat, but openat can help with the unsuccessful opens.

It is far better to use native language constructs, than trying to hack them. I found only one particularly silly rule: a class with a virtual function must have a virtual destructor. It's perfectly reasonable for an object with virtual functions to exist only on the stack, where there can be no confusion about the correct destructor to call, or for it to be destroyed only by its creator. If you were very clever, you could make use of that bootstrap to do something incredible, brilliant and terrifying.

While this is obviously just a very rough indicator, I found this quick listing on the gcc This directory contains the main sources of GCC itself except for runtime libraries. The gcc directory contains many files that are part of the C sources of GCC, other files used as part of the configuration and build process, and subdirectories including documentation and a testsuite.

Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Ask Question. Asked 10 years, 7 months ago. Active 9 days ago. Viewed 31k times. Improve this question. Yes it is mostly. Of course, one needs a C compiler to compile C so, as with most compilers, there is a series of "boot-strap" phases.

Different brand workstations in the s and early 90s had their own unix-like environments with c compiler, tools, etc With the GCC source you could do an initial compile of gcc on one of these platforms, and then compile gcc with itself a few times to more or less check for a fixed point. Add a comment. Active Oldest Votes. Improve this answer. Martinho Fernandes k 68 68 gold badges silver badges bronze badges. Rob Napier Rob Napier k 34 34 gold badges silver badges bronze badges.

Woah, that second article you linked to is insanely clever. Thanks for the great bootstrapping link. I had assumed that compilers were always written in simpler languages all the way back to machine code for sort of this reason.

Basically, there exists, somewhere, a minimal C codebase to build a version of GCC that's capable of building the current GCC codebase. Self-hosting languages have been doing things like that for decades. Creating a compiler that is written in the same language that it compiles is called bootstrapping. The wikipedia article describes a number of ways that a compiler can be bootstrapped. Given your restriction that you only have a post When bootstrapping a compiler using cross-compilation, you build several versions of your compiler.

If you also don't have a PC or similar to perform the initial steps on, then you are indeed stuck, but the chance of being in that situation and trying to bootstrap a compiler are negligible. Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. Ask Question. Asked 6 years, 11 months ago. Active 6 years, 11 months ago.

Viewed 8k times. Improve this question. I'm not sure what you are asking here, though you may wish to read about cross compilation.



0コメント

  • 1000 / 1000