:: Re: [DNG] GTK (was Will there be a …
Startseite
Nachricht löschen
Nachricht beantworten
Autor: Roger Leigh
Datum:  
To: dng
Betreff: Re: [DNG] GTK (was Will there be a MirDevuan "WTF"?)
On 24/07/2015 06:37, Didier Kryn wrote:
> Le 24/07/2015 04:52, Jude Nelson a écrit :
>>
>>     I don't care for it myself - because it is C++.

>>
>> Minor correction: GTK is written in C, and relies on GLib, which is
>> also written C. However, it's open to debate as to how
>> similar/different C-plus-GLib is to C++ in practice.


It's quite clear what the differences are. GLib broadly provides C
equivalents for what you get in the C++ standard library for free.
However, the GLib implementations are often naive, inefficient, not
type-safe and are awkward and complex to use. Doing all the manual
type-casting, refcounting and manual memory management etc. is necessary
in C for generic containers, but completely unnecessary in C.

Consider something trivial, a vector of strings:

std::vector<std::string> list({"item1", "item2", "itemn"});
list.emplace_back("newitem");
for (const auto& item : list)
std::cout << "Item: " << item << '\n';

How much code is required to implement the equivalent with GLib strings
and a list container? It's a good bit longer and with much more
complexity to achieve the same thing. And as we get more complex with
stuff like GObject, it becomes much, much worse.


Regards,
Roger