On 08/20/10 08:30 AM, Garrett D'Amore wrote:
On Fri, 2010-08-20 at 07:58 +1200, Ian Collins wrote:
On 08/20/10 07:48 AM, Garrett D'Amore wrote:
On Thu, 2010-08-19 at 20:14 +0100, Daniel Taylor wrote:

On 19 Aug 2010, at 19:42, Garrett D'Amore wrote:

Out of interest, what language do you recommend?

Depends on the job -- I'm a huge fan of choosing the right tool for the
job.  I just think C++ tries to be jack of all trades and winds up being
master of none.


Drifting slightly back on topic, a lot of the ZFS code (and even more
driver code) I've looked at would be cleaner in C++.  As long as a
library has a C linkage public interface, there aren't any compatibility
issues.  The rest is FUD.
There is no common C++ ABI.  So you get into compatibility concerns
between code built with different compilers (like Studio vs. g++).
Fail.

Which is why we have extern "C". Just about any Solaris driver, library or kernel module could be implemented in C++ behind the C compatibility layer and no one would notice.

There are many many things to dislike about C++ -- you *can* write good
clean code in C++, but almost none of the C++ code I've seen fits that
description.

You should try some of mine!

The various side effects, and unexpected memory explosion that occurs
with the "favored" C++ constructs tends to make C++ completely
unsuitable for use in a kernel.

Those are a QoP (Quality of Programmer) issues. Competent programmers do not fall into those traps. Novices in any language will try and use as much as they can because it's all new. Those of us with older heads know to select the appropriate features for the job in hand. Drivers and kernel modules are a good example; in that world you have to live without the runtime library (which is dynamic only). So you are effectively just using C++ as a superset of C with all the benefits that offers.

I recently coached a DSP team on using C++. All they wanted was a "better C", nothing flash. The big selling point to that team (and others I have worked with) was automatic resource management, the one C++ feature C can't emulate. This is one tool that leads to cleaner, leak free, code.

--
Ian.

_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to