tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] modern c++ compiler written in C (food for thought)


From: Christian Jullien
Subject: Re: [Tinycc-devel] modern c++ compiler written in C (food for thought)
Date: Wed, 28 Oct 2015 06:57:45 +0100

Hi all,

C++ is several orders of magnitude more complex than C. It has the
reputation to be slower than C and, in some sense, it is true when used by
non-highly experimented C++ programmers. (In real life, C++ can outperform C
- I have code that run >2x as fast in C++ --thanks to templates-- than in
C).
>From the start of its design, Bjarne had the goal to let C++ be as fast as
C, provided you are close to C. For short, it's leitmotiv is "pay only for
what you use". That why methods are not "virtual" by default as with Java,
C++ introduced inline functions long before C, exception handling and RTTI
are "optional" features.

But it was not enough, quickly Cfront (C++ -> C translator) was not enable
achieve expected performances. That's why native C++ compilers replace
Cfront now. I also remember that even processors introduced brand new
instructions just to help C++ be faster.

I fully respect the idea to let CFront be usable with tcc (C++ -> tcc
translator), but only as a hobby. I'm really afraid to see discussion on
about to optimize Cfront tcc backend!! IMHO Cfront(tcc) should remain a
'usable' POC, no more.

There are many areas where tcc (C) can be improved, if you know the history
of C++, you can see that most good implementations are not good enough to
survive these days (DMC, Watcom, VisualAge, Borland C++ are all dead
--VisualAge on Windows--).

Christian


-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
Sergey Korshunoff
Sent: mercredi 28 octobre 2015 05:15
To: address@hidden
Subject: *** SPAM *** Re: [Tinycc-devel] modern c++ compiler written in C
(food for thought)

Hi Basile

> A C++ compiler needs to be optimizing. The C++ language specification 
> sort-of requires an > > optimizing compiler

Did you say that a usual C compiler (gcc, clang) can not optimize as a C++
does?
A tcc compiler is a compiler for a development speedup. A final stage can be
build by the usual compiler.

> So the bulk of the compiler would be coded in some language X (to be 
> chosen, or designed > ad-hoc), and it will contain a translator from X to
C or C++ (and the repository would also contain the translated form of that
translator).

There are nim, rock, vala, A good choise for the new project. But there is a
plenty of the medium level C++ programs (even Qt), A C repository of the
such code is a good chance for freedom. And for the source level optimizers.

> For what it is worth, MELT (which is mostly my work) is demonstrating 
> that this is possible, since it is a domain specific language to 
> extend and customize GCC. See http://gcc-melt.org/

Nice! Thanks!

> I'm not motivated enough to start coding alone a compiler for C or C++

Compilers are there. But what we get from them -- only assembler output

_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]