On Mon, Jan 27, 2020 at 08:05:36PM +0100, Christophe de Dinechin wrote: > > > > On 26 Jan 2020, at 16:04, Peter Maydell <peter.mayd...@linaro.org> wrote: > > > > On Sun, 26 Jan 2020 at 08:10, Christophe de Dinechin > > <dinec...@redhat.com> wrote: > >> I’m still puzzled as to why anybody would switch to something like > >> GObject when there is C++. > > > > I'm fairly strongly against using C++. > > Just to be clear, so am I ;-) > > > C++'s language design > > is an "everything including the kitchen sink, lots of "this > > is here for back compat but it's a bear trap", lots of new > > stuff arriving all the time. > > Actually, the new stuff is not that bad, overall. > > I do agree C++ is an overly complicated language, and that in > practice, there is zero chance of qemu moving to it. But that does > not invalidate my point that creating a class in C++ is easier > than creating a class in any C-based macro-heavy reinvention > of basic OO concepts. > > (I write this after having read Paolo’s response, which points > out IMO better reasons for GObject, which I will discuss there). > > > It's just too big to keep in > > your head all at once. C has its faults, absolutely, but at > > least it tries to be a reasonably sized vaguely coherent > > language. > > > > You'd have more luck persuading me we should move to Rust: > > at least then we'd get some clear benefits (no more buffer > > overrun security bugs) for the upheaval :-) > > This is largely a myth as soon as you need to do “your own stuff”. > Example: CVE-2019-18960, https://seclists.org/oss-sec/2019/q4/141.
Calling it a "myth" from from that one data point is not really credible. No language is perfect & such that it can eliminate all possible CVEs. Rust *can*, however, eliminate a very large set of bugs which lead to memory corruption in unchecked languages like C/C++. You'll still have CVEs to deal with, but they'll be different classes of bugs, or rare edge cases like the one you show above. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|