Re: Processes in UNIX
From: G. S. Hayes (sjdevnull_at_yahoo.com)
Date: 10/06/04
- Next message: Rajat: "Re: Help needed for getting the data transfer speed"
- Previous message: Jens.Toerring_at_physik.fu-berlin.de: "Re: File locking (Linux)"
- In reply to: K.M Jr: "Re: Processes in UNIX"
- Next in thread: Rich Teer: "Re: Processes in UNIX"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 6 Oct 2004 07:22:40 -0700
opwv_pspl_test2@yahoo.com (K.M Jr) wrote in message news:<8228b1d2.0410052039.29a3e041@posting.google.com>...
> Not comparing PLs but probably you can tell me the reason why still C
> is so popular for systems programming, I ask this because I do
> maintain that C++ is a better C with many more features (probably
> which aren't required for systems programming).
C++ does have many more features. That's the major problem with it,
IMO; as a language (not library), it's absolutely huge; indeed, it's
so large that very few programmers are able to understand the language
fully (it's hard enough to understand C fully). With a lot of C++
features (exceptions, templates, etc) it's hard to guess what sort of
code is going to be generated; some of those (like exceptions) also
incur a nontrivial run-time penalty.
Less problematically, the typing system is stronger in a lot of cases,
but not always in ways that make _practical_ sense (e.g. requiring
casts of void pointers, which does make _theoretical_ sense) and for
some system tasks I've found myself casting weirdly to get around it
(you can't change the types accepted by core Unix calls).
There's also an argument to be made that the Unix interfaces are often
not the same as "the C++ way". e.g. dealing with TCP sockets doesn't
readily lend itself to an iostream approach, with all the
state/blocking/error conditions you need to deal with. That's
unsurprising since the original Unix guys are also the original C
guys.
For whatever reason, in my experience large C projects (even outside
the realm of systems work) I've worked on have been cleaner and easier
to maintain than large C++ projects. That's purely anecdotal, but
it's worth considering that a relatively large number of open-source
software projects (which need to have clean code that many people can
read and contribute to) have come to the same conclusion. It's
theoretically possible to restrict yourself to a subset of C++ and
give yourself a few nice new features, but in practice what the
compiler offers is going to be used by someone, and the set of
features you want for a lot of systems work turns out to be basically
C anyway.
Note that I'm not arguing against higher level languages in general; I
tend to use a _lot_ of Python in my work (often combined with a small
C extension for a performance-critical corner of the problem), and
I'll often implement portions of a system in other domain-appropriate
languages. I've just found that for me, the kind of middle-level C++
offers hasn't worked out all that well in practice--that's not to say
it can't, if your team is well disciplined.
- Next message: Rajat: "Re: Help needed for getting the data transfer speed"
- Previous message: Jens.Toerring_at_physik.fu-berlin.de: "Re: File locking (Linux)"
- In reply to: K.M Jr: "Re: Processes in UNIX"
- Next in thread: Rich Teer: "Re: Processes in UNIX"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|