On 11/13/2015 10:31 PM, Sergey Korshunoff via Digitalmars-d wrote:
2015-11-11 15:19 GMT+03:00, Walter Bright via Digitalmars-d
I've looked into generating C code as an output format. I found the problems to
be endemic and working around them was harder than just generating native
code:

1. You're at the mercy of bugs in the C compiler you cannot fix.
2. C leaves quite a lot as "implementation defined", causing endless compatibility 
issues with >  various C compilers.
3. C's integral promotion rules.
4. Generating exception handling code for C is miserable and inefficient.
5. Your compiler is going to be slower than C.
6. You'll suffer from endless bug reports caused by a mismatch between your
....
All this problems are not fatal.

True, it just makes things a lot harder.

There is plenty of the "X" to C
translators, even C++.

I'm familiar with cfront from the 80's, and it definitely negatively influenced me on generating C code. Zortech C++ was the first native C++ compiler, and it compiled 4x faster than cfront. cfront was never able to handle "near" and "far". Exception handling didn't exist at the time, but cfront never survived as a viable translator after EH appeared. And, in fact, native compilers completely destroyed the viability of cfront.

Most interesting for me is Vala. And generated
by Vala C code looks nice. Your point of view is a point of the
translator writer. From the user point having a C generated code drops
all needs to descripe how this or thats is implemented by translator,
a more portable code because a C compilers are written for everything
(8051 for example), chance quickly replace and compare different C
compilers and interpreters as backends, chance to use different C
tools  to transform and analyze a code, etc....

That's all fine until you, as translator writer, have to deal with some stupid bug in version X.XX of a C compiler you never heard of used by an important customer of yours.


PS: you just say that C is not suitable for the system programming

No, that is an entirely different statement.

Reply via email to