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


From: Christian Jullien
Subject: Re: [Tinycc-devel] modern c++ compiler written in C
Date: Fri, 15 May 2015 08:50:44 +0200

> If I write some my application with that g++ and then want to start it
using today, a plenty of work is needed to rewrite that application.

For sure! C++ is a language for those who want all bits from their
processor. I work for a company that cares about nanoseconds. Everything we
do in C++ is measured, compared and benckmarked. We use every features C++
provides and, in many cases, we write our own containers.
For customers still using RedHat 6.x and gcc 4.4.x we use 'so called' old
features that have sometimes 20% performance penalties compared to what we
can have with > 4.8.x series.

Of course, I know C++ programs that satisfy themselves with 'basic' C++
features. The difficulty is to agree on 'basic' features. No two C++ users
use the same 'basic' features. Some want only encapsulation + ctor and dtor.
No more. Others want to add inheritance. 

Let take an example. We want 'basic' features to be able to implement
complex numbers (for C99).

class complex {
 private:
double re;
double im;
};

Just to implement this efficiently you need features that only exist in
C++11 like
complex(complex&& rhs);  // Note the &&
complex& operator=(complex& rhs);
friend complex operator"" C(const char* init); // if you want to read a
complex constant as 100C - just an example

And probably exception to refuse c / 0.

Even a trivial class wants to upgrade to modern C++ features.

C++ users fall in to categories:
- casual. They generally do poor C++ code, very often buggy. They'd better
move to Python or Java.
- pro. They use std C++library intensively, know the cost of an operation
and are constantly updating their code that no other language can beat in
term of performance (including C).

The problem is that many casual users think they are 'pro' only because they
use C++.

IMHO, the only reason to use C++ is that you're pro and accept to rewrite
your code often to get benefit of C++ evolutions. C++ is a VERY complex
language hard to master.

Christian

-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
Sergey Korshunoff
Sent: vendredi 15 mai 2015 04:26
To: address@hidden
Subject: Re: [Tinycc-devel] modern c++ compiler written in C

Hi!
>> P.S. except for the fun, who really cares about C++ that old?
> c++ standard is currently evolving *fast*

Yes. Currently it is hard to compile and install g++ 2.95 on modern distro
(require old glibc for C++ stuff). If I write some my application with that
g++ and then want to start it using today, a plenty of work is needed to
rewrite that application. There is no such thing as LTS gcc versions from
FSF.

Solution? May be a small c++ compiler (cfront-1 .. cfront-3) which can be
considered LTS version. Often this one is enough.

_______________________________________________
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]