User: Password:
Subscribe / Log in / New account

You missed the point

You missed the point

Posted Mar 27, 2008 2:12 UTC (Thu) by elanthis (guest, #6227)
In reply to: You missed the point by sylware
Parent article: Striking gold in binutils

Your argument makes no sense.  The C++ compiler stack is part of GCC, and the C++ portions of
the compiler make up such a small percentage of the complexity of the rest of the stack as to
be not worthy of mentioning.  Plus, I'm fairly sure (might be wrong) that the current versions
of GCC have merged the C and C++ parsers.

The complexity of C++ does not mean that you get huge, unwieldly compilers.  It just means
that you have trouble implementing the spec 100% accurately.  It's no different some a
protocol like HTTP.  HTTP (esp v1.1) is actually pretty hard to get fully implemented
correctly.  A lot of HTTP servers get it wrong, as do a lot of clients, and thus there are
certain combinations of HTTP server and client that just don't work together.  Despite this, a
fully correct HTTP server or client implementation is still pretty short, sweet, and easy to
read.  HTTP doesn't force ugly code, it's just not as simple a protocol as one might think it
is.  You can think of C++ the same way.  It doesn't require that much extra effort on top of C
to write a compiler for, but it trying to make sure you cover 100% of the spec is harder than
you might think given how very little C++ adds to the C language.

(Log in to post comments)

You missed the point too

Posted Mar 27, 2008 2:31 UTC (Thu) by sylware (guest, #35259) [Link]

If I need to rewrite from scratch a non optimizing C compiler it's easy. Look at tcc, and I
have plenty of students who had the "small and simple" project of writing a C compiler. Of
course, when we bring C++ on the table, you hear "insane", "crazy", "far to complex" etc... I
was refering to *that* complexity, not the current complexity of the best utra-super
optimizing compiler which is gcc.

You missed the point too

Posted Mar 27, 2008 11:04 UTC (Thu) by nix (subscriber, #2304) [Link]

But a random C compiler reimplementation isn't capable of compiling most of the other parts of
the stack in any case. GCC can be compiled with just about anything that supports ISO C, but
you'll need to reproduce a lot of GCC's (largely undocumented) foibles and language extensions
before you can compile, say, the Linux kernel with it.

I don't really see why the complexity of the *compiler* is relevant anyway. It's not as if GCC
is going to abruptly go away or stop working, so its complexity doesn't negatively impact you
at all.

You missed the point too

Posted Mar 28, 2008 17:20 UTC (Fri) by landley (subscriber, #6789) [Link]

Actually, I'm working on making tinycc (a project derived from tcc) compile the rest of the
stack, including the kernel.  I have rather a lot of work left to do, of course. :)

I find gold interesting, but not useful in my case because tinycc's linker is built-in.  (I'm
reorganizing the code to work as a "swiss army knife" executable ala busybox, but that's not
in -pre2.  Maybe -pre3.)

As for the kernel, the linux-tiny project is working on getting that more modular so we need
to select less of it...


You missed the point

Posted Mar 27, 2008 19:17 UTC (Thu) by tjc (guest, #137) [Link]

> I'm fairly sure (might be wrong) that the current versions
> of GCC have merged the C and C++ parsers.

The C parser was rewritten in gcc 4.1, and I *think* its still separate from the C++ parser.

You missed the point

Posted Mar 28, 2008 22:25 UTC (Fri) by nix (subscriber, #2304) [Link]

Yes. It's not separate from the *Objective C* parser.

(The similarity is that, like the C++ parser, the C parser has now made 
the transition from bison to a hand-rolled parser.)

Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds