KDE3.4RC1: Incompatibility
Scott Wheeler
wheeler at kde.org
Mon Mar 14 20:45:22 GMT 2005
On Monday 14 March 2005 17:07, Martin Ellis wrote:
> On Sunday 13 Mar 2005 20:54, Scott Wheeler wrote:
> > Huh? This is kind of a dumb idea, actually. What will you gain by
> > replacing a well maintained C library with a Qt-based
> > implementation of its API?
>
> Some sanity maybe?
>
> Quoting myself on a different thread on KOffice-devel:
>
> The glib API provides no checking of indices.
>
> Contrast that to something like this from the Qt API
> http://doc.trolltech.com/3.3/qstring.html#at,
> where using out of bounds indices has a defined behaviour
> (defined in the sense that it's not 'buffer overflow').
But you won't get around that with a C API. Without operator overloading you
can't fix:
GString *s = g_string_new("foo");
gchar c = s[10];
Even if you reimplement the API in Qt, you'd still have just overrun some
buffer. Where glib offers such things semantically (i.e. GList), the bounds
are also checked.
-Scott
--
The three chief virtues of a programmer are: laziness, impatience and hubris.
--Larry Wall
More information about the kde-core-devel
mailing list