[cfe-dev] On the preferred use of C++ in the clang source code
Chris Lattner
clattner at apple.com
Fri Nov 9 09:07:27 PST 2007
On Nov 9, 2007, at 8:55 AM, James Widman wrote:
> I've heard that clang is meant to be implemented in a "subset of C+
> +" (which I guess means that some core language features are barred
> from use).
>
> Is there a document anywhere that describes and motivates that subset?
It is pretty subjective. We do use almost all C++ features somewhere
in the (greater llvm) code base. It's really more about making clear
and simple code than it is about banning specific language features.
Some coding guidelines are available here:
http://llvm.org/docs/CodingStandards.html
That said, there are two features we don't like: RTTI and EH. This
is because they violate the "don't pay for it if you don't use it"
principle. If building with GCC, clang disables both RTTI and EH
support (-fno-rtti and -fno-exceptions). The main llvm repository
has a couple of places that still use RTTI, but we'd like to fix that.
The main problem with RTTI and EH is the impact on binary size. Many
clients of LLVM and at least one client of clang use them in a JIT
context. Having the binaries be as small as possible makes it easier
for people to distribute them with their apps.
-Chris
More information about the cfe-dev
mailing list