Related articles |
---|
Optimizing in assembly language rhyde@transdimension.com (Randall Hyde) (2001-03-01) |
Re: Optimizing in assembly language sunni@speakeasy.net (Shankar Unni) (2001-03-04) |
Re: Optimizing in assembly language sunni@speakeasy.net (Shankar Unni) (2001-03-26) |
C as assembly language joachim_d@gmx.de (Joachim Durchholz) (2001-04-04) |
Re: C as assembly language eodell@c1220335-a.potlnd1.or.home.com (2001-04-10) |
Re: C as assembly language andi@complang.tuwien.ac.at (2001-04-10) |
Re: C as assembly language jmorris2@twcny.rr.com (Morrisett) (2001-04-10) |
Re: C as assembly language jacob@jacob.remcomp.fr (jacob navia) (2001-04-10) |
Re: C as assembly language felixundduni@freenet.de (felix) (2001-04-10) |
Re: C as assembly language fjh@cs.mu.OZ.AU (2001-04-10) |
Re: C as assembly language fjh@cs.mu.OZ.AU (2001-04-12) |
Re: C as assembly language vbdis@aol.com (2001-04-12) |
Re: C as assembly language felixundduni@freenet.de (felix) (2001-04-14) |
Re: C as assembly language fjh@cs.mu.OZ.AU (2001-04-14) |
[9 later articles] |
From: | "jacob navia" <jacob@jacob.remcomp.fr> |
Newsgroups: | comp.compilers |
Date: | 10 Apr 2001 01:30:03 -0400 |
Organization: | Wanadoo, l'internet avec France Telecom |
References: | 01-03-006 01-03-046 01-03-130 01-04-027 |
Keywords: | C, GCC |
Posted-Date: | 10 Apr 2001 01:30:03 EDT |
I would like to point out that some of the problems of C as an
assembly language are just wrong, using the specific example of the
lcc-win32 system. No environment is "perfect" but I think lcc-win32
comes close, and is widely used as a back end compiler.
> Hmm... there are a few additional cases where C is simply inappropriate:
> 1) You want to check for integer overflow.
Under lcc-win32 you just write
c = a+b;
if (_overflow()) {
// Overflow handling
}
> 2) You need exceptions.
lcc-win32 lets you use the exceptions defined by the OS.
The setjmp/longjmp facility allows you to implement any exception schema you
need.
> Oh, and slightly off-topic, there are a few other things that annoy
> those who want to use C as a backend for their compiler:
> 3) It has no support for tail call recursion.
Not very difficult to implement in the generated C with a few assignments
and a goto...
> 4) It has no support for automatic garbage collection.
lcc-win32 features an automatic garbage collector (Boehm's)
> (The following are from http://www.cminusminus.org/faq.html:)
> 5) It cannot return multiple values in registers
Multiple values in registers?
In general C shields you from assembly. The register layout is defined by
the compiler. Nothing prevents you from building your own schemas of course.
> 6) It cannot bind global variables to registers
In the x86, with only 6 registers this would be impossible, but in other
architectures, the C compiler lets you assign globals to the global
registers with some compiler specific syntax.
> 7) It has no support for lightweight concurrency
Well, under windows you can use the thread facility of the operating system.
Lcc-win32 supports it of course.
>
> Not all of these features are required for each language, but many
> (most?) languages need at least one of them.
lcc-win32 is used as a back end for Objective C Eiffel and other
customer specific languages.
But a language system is not the compiler back end only. When looking
at the alternatives you should include the existence of a configurable
linker and above all a configurable debugger. It is those features
that make actually a system usable as a back end or not. The compiler
is just a part of it.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.