2002-01-01 04:11:34

by samson swanson

[permalink] [raw]
Subject: a great C++ book?

hello again,

i ask this group because i trust in your intellect.

For a beginner to C++ what is your favorite book? A
book that goes in depth of teaching the language.
remeber i am a beginner, new to c++.

thank you

__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com


2002-01-01 04:35:53

by Todor Todorov

[permalink] [raw]
Subject: Re: a great C++ book?

samson swanson wrote:

>
>For a beginner to C++ what is your favorite book? A
>book that goes in depth of teaching the language.
>remeber i am a beginner, new to c++.
>
Nicolai Josuttis, Object Oriented Programming in C++, Addison-Wesley 2001

This guy is on the C++ standartization comitee,the book is intended for
complete beginners as for advanced programmers - it starts with the
basic concepts and goes smootly into more advanced topics, it's fairly
simple to understand and the examples are staright to the point and well
explained. Besides this, it describes very good the concepts of OOP.

Greetings,
Todor


2002-01-01 04:40:33

by Larry McVoy

[permalink] [raw]
Subject: Re: a great C++ book?

On Mon, Dec 31, 2001 at 08:11:11PM -0800, samson swanson wrote:
> For a beginner to C++ what is your favorite book? A
> book that goes in depth of teaching the language.
> remeber i am a beginner, new to c++.

I really like the original book by Bjarne Stroustrop, he's the guy that
designed the language and wrote what was supposed to be the C book
for C++.
--
---
Larry McVoy lm at bitmover.com http://www.bitmover.com/lm

2002-01-01 05:17:39

by David A. Frantz

[permalink] [raw]
Subject: Re: a great C++ book?

Hi Samson;

While the other books that have already been mentioned are very good, maybe
even required, for the absolute beginner I reccomend Accellerated C++ by
Koenig and Moo. One book is not enough though, Accellerated C++ should be
supplemented with a good C++ reference.

Dave


samson swanson wrote:

> hello again,
>
> i ask this group because i trust in your intellect.
>
> For a beginner to C++ what is your favorite book? A
> book that goes in depth of teaching the language.
> remeber i am a beginner, new to c++.
>
> thank you
>
> __________________________________________________
> Do You Yahoo!?
> Send your FREE holiday greetings online!
> http://greetings.yahoo.com
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

2002-01-01 18:25:30

by Oliver Xymoron

[permalink] [raw]
Subject: Re: a great C++ book?

On Mon, 31 Dec 2001, samson swanson wrote:

> hello again,
>
> i ask this group because i trust in your intellect.
>
> For a beginner to C++ what is your favorite book? A
> book that goes in depth of teaching the language.
> remeber i am a beginner, new to c++.

If you already know C well, Bjarne Stroustrup's "The C++ Programming
Language" is decent. If not, start with Kernighan and Ritchie's "The C
Programming Language". Put the two next to each other and you might gain
some insight into the creeping horror that modern C++ has become.

--
"Love the dolphins," she advised him. "Write by W.A.S.T.E.."

2002-01-01 18:43:52

by Larry McVoy

[permalink] [raw]
Subject: Re: a great C++ book?

On Tue, Jan 01, 2002 at 12:25:10PM -0600, Oliver Xymoron wrote:
> On Mon, 31 Dec 2001, samson swanson wrote:
>
> > hello again,
> >
> > i ask this group because i trust in your intellect.
> >
> > For a beginner to C++ what is your favorite book? A
> > book that goes in depth of teaching the language.
> > remeber i am a beginner, new to c++.
>
> If you already know C well, Bjarne Stroustrup's "The C++ Programming
> Language" is decent. If not, start with Kernighan and Ritchie's "The C
> Programming Language". Put the two next to each other and you might gain
> some insight into the creeping horror that modern C++ has become.

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.

This sends a somewhat mixed message to the casual observer who might think
that one language or the other is "better". 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.".

Makes you wonder what would happen if someone tried to design a
minimalistic C++, call it the "M programming language", have be close
to C with the minimal useful parts of C++ included.

I've always said that if I get rich I'm going to fund some extensions to
GCC to make associative arrays be a built in type, to make perl like
regex's be a first class object, but maybe I was wrong, maybe I want to
fund "M" :-) Sort of a moot point, I'm not rich.
--
---
Larry McVoy lm at bitmover.com http://www.bitmover.com/lm

2002-01-01 20:01:57

by Richard Gooch

[permalink] [raw]
Subject: Re: a great C++ book?

Larry McVoy writes:
> On Tue, Jan 01, 2002 at 12:25:10PM -0600, Oliver Xymoron wrote:
> > On Mon, 31 Dec 2001, samson swanson wrote:
> >
> > > hello again,
> > >
> > > i ask this group because i trust in your intellect.
> > >
> > > For a beginner to C++ what is your favorite book? A
> > > book that goes in depth of teaching the language.
> > > remeber i am a beginner, new to c++.
> >
> > If you already know C well, Bjarne Stroustrup's "The C++ Programming
> > Language" is decent. If not, start with Kernighan and Ritchie's "The C
> > Programming Language". Put the two next to each other and you might gain
> > some insight into the creeping horror that modern C++ has become.
>
> 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.
>
> This sends a somewhat mixed message to the casual observer who might
> think that one language or the other is "better". 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.".

An extract from the FAQ about C++: http://www.tux.org/lkml/#s1-4

"My personal view is that C++ has it's merits, and makes
object-oriented programming easier. However, it is a more complex
language and is less mature than C. The greatest danger with C++ is in
fact it's power. It seduces the programmer, making it much easier to
write bloatware. The kernel is a critical piece of code, and must be
lean and fast. We cannot afford bloat. I think it is fair to say that
it takes more skill to write efficient C++ code than C code. Not every
contributer to the linux kernel is an uber-guru, and thus will not
know the various tricks and traps for producing efficient C++ code."

Object-oriented programming is a good tool. One of many. But it
shouldn't be a religion, nor do you need to write in C++ to make use
of it. A good example of object-oriented programming done in C is the
Xt toolkit.

> Makes you wonder what would happen if someone tried to design a
> minimalistic C++, call it the "M programming language", have be
> close to C with the minimal useful parts of C++ included.

I'm sure lots of people have thought about this. A friend of mine and
I sat down once and did a rough design for the "K" language, which was
supposed to be "exactly like C, only better". Basically, we wanted to
cherry-pick the good bits of C++, plus add some other things. As
usual, lack of time is the enemy. Besides, what's point unless it gets
widely used, and the chance of that is small.

Regards,

Richard....
Permanent: [email protected]
Current: [email protected]

2002-01-02 00:32:06

by J.A. Magallon

[permalink] [raw]
Subject: Re: a great C++ book?


On 20020101 Larry McVoy wrote:
>
>Makes you wonder what would happen if someone tried to design a
>minimalistic C++, call it the "M programming language", have be close
>to C with the minimal useful parts of C++ included.
>

There are specs for something called 'Embedded C++'. You can run it on
a cell phone, so it looks like little bloated...

--
J.A. Magallon # Let the source be with you...
mailto:[email protected]
Mandrake Linux release 8.2 (Cooker) for i586
Linux werewolf 2.4.18-pre1-beo #3 SMP Thu Dec 27 10:15:27 CET 2001 i686

2002-01-02 00:40:08

by J.A. Magallon

[permalink] [raw]
Subject: Re: a great C++ book?


On 20020101 Richard Gooch wrote:
>
>Object-oriented programming is a good tool. One of many. But it
>shouldn't be a religion, nor do you need to write in C++ to make use

Use the right tool for the purpose. You bet for rewriting half the
C++ runtime in C instead of not-using the bloated part of C++.
Pretty. If you're going to program in a OO way, use an oo language.
And I get tired of people saying C++ is bloat. My pupils at 5th course
of Computer Science still think C++ is bloat. They have no idea on
compilers. And they bless Ada.
A 5th level virtual function still has only a one-level
indirection overhead when called. Low level code is just as efficient
as C. If a C++ program is bloated it is the programmers matter, not
the language.

>of it. A good example of object-oriented programming done in C is the
>Xt toolkit.
>

kidding ????
Perhaps GTK+, but Xt...

By

--
J.A. Magallon # Let the source be with you...
mailto:[email protected]
Mandrake Linux release 8.2 (Cooker) for i586
Linux werewolf 2.4.18-pre1-beo #3 SMP Thu Dec 27 10:15:27 CET 2001 i686

2002-01-02 01:11:31

by H. Peter Anvin

[permalink] [raw]
Subject: Re: a great C++ book?

Followup to: <[email protected]>
By author: Larry McVoy <[email protected]>
In newsgroup: linux.dev.kernel
>
> Makes you wonder what would happen if someone tried to design a
> minimalistic C++, call it the "M programming language", have be close
> to C with the minimal useful parts of C++ included.
>

Personally I have found that it's quite clean and easy to program in
"C+" by simply using a C++ compiler and just not going wild with all
the features that you *could* use. You don't *have* to use all of it,
you know. In that way, your "M" language really becomes a particular
*style* of C++ rather than a full-blown programming language in its
own right. This is actually a Good Thing[TM], since it means you can
leverage existing compilers and so forth.

Way back in the 0.99.x days we actually tried doing the Linux kernel
using the g++ compiler, the main motivation for that was to get
type-safe linkage. At that time, as everyone knows, g++ wasn't up to
snuff; that has probably changed now. The LKML FAQ claims that "there
would be no point" unless we started using C++ features left and
right; personally I think type-safe linkage is plenty of reason
enough.

I think it might be worth another attempt once gcc 3.x stabilizes
enough that it's the accepted standard compiler. It will be more
invasive this time around, because of the module system, but the
benefit might be greater.

-hpa
--
<[email protected]> at work, <[email protected]> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt <[email protected]>

2002-01-02 01:30:14

by Alexander Viro

[permalink] [raw]
Subject: Re: a great C++ book?



On 1 Jan 2002, H. Peter Anvin wrote:

> Personally I have found that it's quite clean and easy to program in
> "C+" by simply using a C++ compiler and just not going wild with all
> the features that you *could* use. You don't *have* to use all of it,
> you know. In that way, your "M" language really becomes a particular
> *style* of C++ rather than a full-blown programming language in its
> own right. This is actually a Good Thing[TM], since it means you can
> leverage existing compilers and so forth.

You've just described the reasons why Algol 68 is a Bad Thing(tm). Everyone
has his own subset and almost nobody understands what exactly happens in
others' code.

> Way back in the 0.99.x days we actually tried doing the Linux kernel
> using the g++ compiler, the main motivation for that was to get
> type-safe linkage. At that time, as everyone knows, g++ wasn't up to
> snuff; that has probably changed now. The LKML FAQ claims that "there
> would be no point" unless we started using C++ features left and
> right; personally I think type-safe linkage is plenty of reason
> enough.

We can't get people to follow common style and you expect adherence to
some subset of the language smaller than "compiler doesn't spit errors
on that"? Dream on.

And then there is "six month ago I cud not spel injuneer and now I r won"
crowd - and quite a few of them seem to be afraid of C. FWIC it is a
damn good reason to stay with C...

2002-01-02 01:41:42

by Richard Gooch

[permalink] [raw]
Subject: Re: a great C++ book?

J. A. Magallon writes:
>
> On 20020101 Richard Gooch wrote:
> >
> >Object-oriented programming is a good tool. One of many. But it
> >shouldn't be a religion, nor do you need to write in C++ to make use
>
> Use the right tool for the purpose. You bet for rewriting half the
> C++ runtime in C instead of not-using the bloated part of C++.
> Pretty. If you're going to program in a OO way, use an oo language.
> And I get tired of people saying C++ is bloat.

Actually, I didn't say that C++ is bloat. I said C++ makes "it much
easier to write bloatware". Big difference.

> My pupils at 5th course of Computer Science still think C++ is
> bloat.

Good. That means they'll approach it with caution, rather than jumping
on the bandwagon.

> They have no idea on compilers. And they bless Ada. A 5th level
> virtual function still has only a one-level indirection overhead
> when called. Low level code is just as efficient as C. If a C++
> program is bloated it is the programmers matter, not the language.

Not when the language seduces you into writing bloatware. The more
powerful the language and the more abstract the concepts it supports,
the further the programmer is taken away from understanding what's
happening at the low level. That leads to bloatware.

If I had my way, no CS student would graduate unless they understood
what's happening at the low level and had experience benchmarking and
optimising code. A good start would be to have at least one assignment
where they have to write a reasonably complex piece of code, in any
language, and their marks are based on how fast the code runs. And the
marks should be scaled down if everyone writes code which is much
slower than the instructor's.

Regards,

Richard....
Permanent: [email protected]
Current: [email protected]

2002-01-02 02:45:40

by Dan Maas

[permalink] [raw]
Subject: Re: a great C++ book?

> 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

2002-01-02 04:22:11

by Michael P. Soulier

[permalink] [raw]
Subject: Re: a great C++ book?

On 01/01/02 Alexander Viro did speaketh:

> And then there is "six month ago I cud not spel injuneer and now I r won"
> crowd - and quite a few of them seem to be afraid of C. FWIC it is a
> damn good reason to stay with C...

:) That's because they picked-up "Visual Basic for Dummies" and now
they claim to be programmers. *sigh*

Mike

--
Michael P. Soulier <[email protected]>, GnuPG pub key: 5BC8BE08
"...the word HACK is used as a verb to indicate a massive amount
of nerd-like effort." -Harley Hahn, A Student's Guide to Unix


Attachments:
(No filename) (544.00 B)
(No filename) (232.00 B)
Download all attachments

2002-01-02 13:58:56

by kaih

[permalink] [raw]
Subject: Re: a great C++ book?

[email protected] (J.A. Magallon) wrote on 02.01.02 in <[email protected]>:

> On 20020101 Larry McVoy wrote:
> >
> >Makes you wonder what would happen if someone tried to design a
> >minimalistic C++, call it the "M programming language", have be close
> >to C with the minimal useful parts of C++ included.
> >
>
> There are specs for something called 'Embedded C++'. You can run it on
> a cell phone, so it looks like little bloated...

Wrong metric, unless you mean you can run the *compiler* on the cell
phone.

c99.pdf: 1412026 bytes
c++98.pdf: 2860601 bytes

And remember that interactions between features go up exponentially.

I think one of the worst design decisions for C++ (hindsight, of course)
was to keep compatibility with C. The other bad one was to accept too many
new features.

The Modula-3 standard (that's an OO variant of Modula-2) had as a language
design goal that the language description should not take more than 50
pages. They overshot that, but it still was much less than 100 (somewhat
less precise than C/C++, admittedly). As a result, that language (and
consequently, programs in that language) is *much* easier to understand
than C++.

That doesn't mean I'm in love with Modula-3. Actually, I don't even use
it, and I do think (hindsight again) some of the design decisions were
unfortunate. But I do think keeping an eye on the sheer mass of the spec
is a good idea.

MfG Kai

2002-01-02 15:44:12

by Oliver Xymoron

[permalink] [raw]
Subject: Re: a great C++ book?

On 1 Jan 2002, H. Peter Anvin wrote:

> Way back in the 0.99.x days we actually tried doing the Linux kernel
> using the g++ compiler, the main motivation for that was to get
> type-safe linkage. At that time, as everyone knows, g++ wasn't up to
> snuff; that has probably changed now. The LKML FAQ claims that "there
> would be no point" unless we started using C++ features left and
> right; personally I think type-safe linkage is plenty of reason
> enough.

Hardly - the problems it would solve are infrequent and the solution open
numerous cans of worms.

--
"Love the dolphins," she advised him. "Write by W.A.S.T.E.."

2002-01-02 18:50:50

by Timothy Covell

[permalink] [raw]
Subject: Re: a great C++ book?

On Tuesday 01 January 2002 22:22, Michael P. Soulier wrote:
> On 01/01/02 Alexander Viro did speaketh:
> > And then there is "six month ago I cud not spel injuneer and now I r won"
> > crowd - and quite a few of them seem to be afraid of C. FWIC it is a
> > damn good reason to stay with C...
> >
> :) That's because they picked-up "Visual Basic for Dummies" and now
>
> they claim to be programmers. *sigh*
>
> Mike

I got my degree in Physics, so I learned to program in Fortran. In
that day, however, there were folks who were clamoring for more C
programming in science. I took one look at it and gagged on the pointers
and mallocs. In my opinion, no scientist should trust C code for important
numerical work unless he has too; that's why Fortran was created in the first
place.

Anyhow, one of the local self-appointed Unix gurus was aghast at
my distaste for C's primitiveness. Alas, I feal justified today because
Perl, Java, C#, and Cyclone are proving that C is for systems programming and
not for everyday use.

That much said, I still am only fluent in Fortran, shell, Perl (and a little
Tcl/TK), so I don't really consider myself a programmer, just a sysadmin with
a clue.


--
[email protected].