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

Mr. Richie on C in Inferno; about a C++ to Limbo tool

(The best place for this discussion is in <news:comp.lang.limbo>, but I
guess this interest a lot of people in the c/C++ groups. The quotes are
from the Inferno mailing list, archived at
<http://www.artnet.com.br/inferno/> and

The question is: how can you port existing C and C++ programs easily to
Inferno (<http://www.lucent.com/inferno/>)?

I suggest we could evolve a rough C++ to Limbo compiler transforming
POSIX, Motif and Microsoft Foundation Classes interfaces to Inferno
library module calls. It would flag and document problem areas for
further work by the programmer. As Mr. Dennis Richie
(<dmr@plan9.bell-labs.com>) pointed out eralier:

> The C language 
> proper could be compiled without undue difficulty into safe Dis code.  
> Probably the crucial realization for the  compiler-writer
> is that a C pointer needs to be represented as an array, and for the
> C program-writer (or adapter) that the ANSI/ISO standard is more strict
> in what it promises than most people realize.  Some things look tough
> to do without help from the run-time (setjmp/longjmp), some seem tough
> (like variadic argument lists) but might yield to careful thought.
> Some things (like function pointers) aren't visible in Limbo but
> have been anticipated (at least in stub form) in the interpreter.
> It would be an interesting exercise, in that it might provide an
> environment that enforced conformance, even at run time, to
> the C standard.  On the other hand, I'd bet that the X windows
> server and libraries would be really hard to port.

Greg Kochanski <gpk@bell-labs.com> wrote:

> There is no C compiler for Inferno, largely because
> Inferno eliminates most memory allocation problems
> by doing garbage collection, and C is not really
> compatible with garbage collection.

It is not clear to me is, why you could not run a process, which does
not do garbage collection, on Inferno. Is it the the system modules,
which expect the garbage collector to work? What if they are augmented
with explicit close/free functions to be used by non garbage collecting
languages? And, besides, Berry Kercheval :: kerch@parc.xerox.com :: 
Xerox Palo Alto Research Center tells us:

> I know this isn't really about Inferno, 
> but I feel constrained to point out 
> that garbage collection CAN work quite well with C, 
> and there's a modified 
> malloc (and friends) library available to do it.  Check out 
>           ftp://parcftp.parc.xerox.com/pub/gc/issues.html
> for details and a pointer to the code.

Anssi <http://www.dlc.fi/~porttiki>
Use a long, non-copied title or I won't have time to open your message!