From: "Dan Maas" <dmaas@dcine.com>
To: "Larry McVoy" <lm@bitmover.com>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: a great C++ book?
Date: Tue, 1 Jan 2002 21:45:26 -0500 [thread overview]
Message-ID: <01a101c19337$88c1ef60$1a01a8c0@allyourbase> (raw)
In-Reply-To: <fa.j24p57v.1d34p2v@ifi.uio.no> <fa.i865mpv.1g42885@ifi.uio.no>
> It's hard to explain a love/hate relationship with C++. I think many
> systems programmers come to a point where they can "speak" C++ and do so
> in design conversations all the time, talking about the "objects" and the
> "methods", etc. But they program in C. [...] The reality is that you want
> tp program in a fairly object oriented way but you also want to avoid
> "the creeping horror that modern C++ has become.".
These statements resonate very strongly with my experience... A few times
already I've said to myself "today is the day I start using C++ instead of
C." But every time I've turned back.
To be fair, most of the problems I encountered were
quality-of-implementation issues rather than problems with C++ the language.
(The only serious complaint I have about C++ the language is the lack of
opaque types -- yes, I know of the famous "pimpl" idiom, and find its syntax
and inefficiency rather disgusting).
If you read Stroustrup's "The Design and Evolution of C++," [book
recommendation =)] you will gain an appreciation of the effort the language
designers spent to ensure that C++ imposed no overhead for features that
aren't used. However, I've found that G++ and the associated GNU
implementation of the C++ standard library do not really deliver on this
promise. The assembly code output by G++ is often cluttered with seemingly
unnecessary cruft (way beyond the expected overheads of e.g. virtual table
indirections for virtual function calls). And don't even get me started on
all the gunk it puts in your symbol table (run nm(1) on any C++ object and
you'll see what I mean). (yes I know about -fno-exceptions and -fno-rtti)
You might say, "who cares about crufty assembly here and there, much less
symbol table pollution?" While these issues might not concern the typical
application developer, I care very much about cleanliness of my code, and I
know the Linux kernel hackers are very aware of how their C code interacts
with GCC...
I long for the day when I will be able to declare a struct member private,
use inheritance, and declare a local variable anywhere in a basic block in
my code... But I need to have a clean C++ compiler and library
implementation with true pay-as-you-go overheads before I make the switch.
Regards,
Dan
next parent reply other threads:[~2002-01-02 2:45 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <fa.j24p57v.1d34p2v@ifi.uio.no>
[not found] ` <fa.i865mpv.1g42885@ifi.uio.no>
2002-01-02 2:45 ` Dan Maas [this message]
2002-01-01 4:11 a great C++ book? samson swanson
2002-01-01 4:40 ` Larry McVoy
2002-01-01 5:17 ` David A. Frantz
2002-01-01 5:34 ` Todor Todorov
2002-01-01 18:25 ` Oliver Xymoron
2002-01-01 18:43 ` Larry McVoy
2002-01-01 20:01 ` Richard Gooch
2002-01-02 0:42 ` J.A. Magallon
2002-01-02 1:41 ` Richard Gooch
2002-01-02 0:34 ` J.A. Magallon
2002-01-02 9:59 ` Kai Henningsen
2002-01-02 1:10 ` H. Peter Anvin
2002-01-02 1:29 ` Alexander Viro
2002-01-02 4:22 ` Michael P. Soulier
2002-01-02 18:46 ` Timothy Covell
2002-01-02 15:43 ` Oliver Xymoron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='01a101c19337$88c1ef60$1a01a8c0@allyourbase' \
--to=dmaas@dcine.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lm@bitmover.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox