|
|
Log in / Subscribe / Register

It's definitely doable in the free software world.

It's definitely doable in the free software world.

Posted Nov 16, 2008 22:22 UTC (Sun) by Ed_L. (guest, #24287)
In reply to: It's definitely doable in the free software world. by Ze
Parent article: Things that go Clang in the night: LLVM 2.4 released (ars technica)

The choice of C vs. C++ for GTK+ was made by the GTK+ developers. Its only relevant to some one else if that some one wants to actually hack GTK+ code. I've been using the GTKmm C++ wrapper for five years now, it works quite well. Given that one of the design goals for GTK+ was a requirement that GTK+ be wrappable by many different languages, I'm not absolutely certain C was the wrong choice. Yes, Gobj() is ugly, but to make the library wrappable would require a C API to all its exposed public methods anyway, because of (I suppose) different object and inheritance models in different languages. So I'm not certain having allowing C++ under the covers would have bought them a great deal. That, and I suspect the GTK+ team shares many of this threads sentiments r.e. C++. Their choice. GTKmm certainly fills my needs, so I don't worry about GTK+ much one way or the other.


to post comments

It's definitely doable in the free software world.

Posted Nov 17, 2008 14:53 UTC (Mon) by cortana (subscriber, #24596) [Link] (2 responses)

I like gtkmm a lot, but I find not being able to use exceptions a real pain in the arse. :(

It's definitely doable in the free software world.

Posted Nov 17, 2008 23:45 UTC (Mon) by Ed_L. (guest, #24287) [Link] (1 responses)

Not sure what you mean. I use Glibmm exceptions extensively throughout my code, they work pretty much the same as C++ exceptions. I haven't tried mixing C++ exceptions into this environment, so I can't comment on what would happen then. But Glibmm exceptions throw just fine.

It's definitely doable in the free software world.

Posted Sep 1, 2009 12:40 UTC (Tue) by cortana (subscriber, #24596) [Link]

Whoa, oooold thread. But I thought I'd refer to the gtkmm documentation:

Can I use C++ exceptions with gtkmm?

Yes, it is possible but it is not a very good idea. The official answer is that, since plain C doesn't know what a C++ exception is, you can use exceptions in your gtkmm code as long as there are no C functions in your call stack between the thrower and the catcher. This means that you have to catch your exception locally.

You will be warned at runtime about uncaught exceptions, and you can specify a different handler for uncaught exceptions. Some gtkmm methods do even use exceptions to report errors. The exceptions types that might be thrown are listed in the reference documentation of these methods.

It's the typical C++-code-called-by-C-code hooplah that I have to go through that makes use of gtkmm more annoying than it could have been.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds