Re: [gtk-list] Re: Why is gtk+ written in C?
- From: Andreas Kostyrka <andreas rainbow studorg tuwien ac at>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Why is gtk+ written in C?
- Date: Wed, 14 Oct 1998 13:50:51 +0200 (CEST)
On Tue, 13 Oct 1998, Eric Harlow wrote:
> 
> Isn't C++ portable? 
> Couldn't GTK have been written C++ with bindings to other languages? 
The problem is that not all other languages are written in C++.
(Or offer C++ access features.)
So in the best case it would be:
write C wrapper functions for the C++ stuff.
write language X wrapper for the C stuff.
Examples, I know personally, are TOM (which allows to embed C code
directly, but NOT C++), ...
Leaving thin mundane stuff, there are some other problems:
-) Consider a library xyz that contains in fact the interpreter for
   language xyz. It's written in C and compiled with the C compiler.
-) Consider now a C++ library that uses callbacks (GUI stuff usually
   does):
   C++            (C++ compiled)       main function
   C              (C compiled)         interpreter main loop
   C++            (C++ compiled)       GUI toolkit event loop.
   C              (C compiled)         callback (into the xyz language)
   C++            (C++ compiled)       some manipulator function.
   Now NOTHING in in the ANSI C standard defines that C++ exception are
   propageted across C code. So forget about exception.
-) Additionally, you have to consider that almost all newer languages
   come with some kind of GC. Again it's probably easier to interface with
   C as with C++ which already comes with some idea of
   constructors/destructors.
Andreas
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]