kern/99979: Get Ready for Kernel Module in C++
Rick C. Petty
rick-freebsd at kiwi-computer.com
Tue Jul 11 22:46:29 UTC 2006
On Wed, Jul 12, 2006 at 02:25:21AM +0800, mag at intron.ac wrote:
> Matthias Andree wrote:
> Why would people write Windows application with rather MFC/ATL/.NET
> Framework than direct Windows API?
Because they like buggy code? (Not that the basic API is much better)
> Why is gtkmm created for GTK+?
Because they enjoy extremely long compile times? And they like wrappers
around wrappers around wrappers?
> Would you write a X11 application with original X11 API, without QT or
> other X11 toolkits?
Comparing KDE/Qt to GNOME/GTK+ is comparing C++ to C. I personally prefer
the GTK API (GDK is quite similar to the X11 API) over Qt. My preference
is mostly due to the overhead and complexity of C++. C++ and Java are
great for Applications, not as much so for kernels. I don't mean to drag
this into a KDE vs. GNOME flame war.
Also this is not a fair comparison because these toolkits augment what X11
provides, much like how userland augments a kernel. Write the front-end in
whatever language/toolkit you prefer; you're still calling Xlib to pass
packets to/from the X server.
> Good packages for various APIs are much easier to learn/debug than those
> original APIs.
What makes you say that C++ would provide a good API? I think perhaps the
problem may be that the current kernel APIs in C are insufficient... but
introducing the complexity of C++ both from a language perspective and
from a standard library perspective seems silly to me. When on the device
driver level, I would rather know precisely when my code is being called
and manage my own memory, etc. and other nitty-gritty details.
I agree that a good API is crucial! But I also believe that C provides
this better than others. You can always write code in C++ which calls C
functions, but the converse is quite tricky.
-- Rick C. Petty
More information about the freebsd-hackers