From: Nicola Musatti on
On Feb 14, 2:41 pm, Neil Cerutti <horp...(a)yahoo.com> wrote:
[...]
> Don't forget the lack of standard garbage collection.

Optional garbage collection is highly likely to be included in the
next C++ standard, due out in a couple of years.

> Also there's the hell known as exception safety.
>
> Python conceptually has many of the same issues with exception
> safety, but at least memory leaks aren't one of the consequences.
> I imagine most Python programmers don't even think about
> exception safety, but probably should be. We just happily raise
> exceptions willy-nilly, without worrying about our objects
> remaining in a reasonable state. Or do we? Maybe it's better not
> to think about it. ;-)

On the other hand having everything dynamically allocated prevents the
adoption of deterministic destruction, which is a far better clean up
mechanism than try/finally clauses.

In modern C++ standard containers and smart pointers help solve most
memory related problems. I'm aware that most is not the same as all,
but on the other hand garbage collection has it's problems too:
depending on the algorithm it may not be able to reclaim all the
unreachable memory and forgetting to explicitly reset variables may
lead to hanging to memory that is really not needed anymore.

Cheers,
Nicola Musatti

From: Aahz on
In article <1171303251.796306.79520(a)p10g2000cwp.googlegroups.com>,
Thomas Nelson <thn(a)mail.utexas.edu> wrote:
>
>I realize I'm approaching this backwards from the direction most
>people go, but does anyone know of a good c/c++ introduction for
>python programmers?

This isn't an introduction, but you should probably also pick up
_Effective C++_ (and possibly _More Effective C++_, though that seems
less useful to me).
--
Aahz (aahz(a)pythoncraft.com) <*> http://www.pythoncraft.com/

"I disrespectfully agree." --SJM
From: Neil Cerutti on
On 2007-02-14, Aahz <aahz(a)pythoncraft.com> wrote:
> In article <1171303251.796306.79520(a)p10g2000cwp.googlegroups.com>,
> Thomas Nelson <thn(a)mail.utexas.edu> wrote:
>>I realize I'm approaching this backwards from the direction
>>most people go, but does anyone know of a good c/c++
>>introduction for python programmers?
>
> This isn't an introduction, but you should probably also pick
> up _Effective C++_ (and possibly _More Effective C++_, though
> that seems less useful to me).

I did enjoy _Effective C++_ very much, but in fact there's
nothing in there that's not already stated in _The C++
Programming Language_. Granted, TCPL is so dense that it wasn't
until *after* reading _Effective C++_ (Scott Meyers), that I
noticed this.

--
Neil Cerutti
From: Anders Arnholm on
Nicola Musatti <nicola.musatti(a)gmail.com> skriver:
> On Feb 14, 2:41 pm, Neil Cerutti <horp...(a)yahoo.com> wrote:
> [...]
>> Don't forget the lack of standard garbage collection.
> memory related problems. I'm aware that most is not the same as all,
> but on the other hand garbage collection has it's problems too:

And that garbabe collection is only good for memory, garbage
collecting open files and network connections work much less
well. Giving the need to add a maonual "delete" function to be called
before the object is destroed when you need the life time controll.
And this having to be reflected in application depenednt way to figure
out how it works in each application.

/ Balp
--
http://anders.arnholm.nu/ Keep on Balping
From: Michael on
Thomas Nelson wrote:

> I realize I'm approaching this backwards from the direction most
> people go, but does anyone know of a good c/c++ introduction for
> python programmers?

There's been lots of answers, but no-one's mentioned the book I like:
* Accelerated C++ by Koenig & Moo

It dives straight into C++ - rather than attempting to say "look, C++ is
built ontop of C, so I'll teach you C first, I'll recognise that the idioms
for developing in C++ are different and start from there instead".

It's in my opinion by far and away one of the best intros I've read. (I'm
not saying that lightly either - I rank it as good/language relevant an
introduction as Learning Perl used to be, and the K&R book can be for many
C developers).

In many respects it'll also show you some of the similarities between python
and C++, and the differences.


Michael.