Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #8515 > unrolled thread

Why use C++?

Started byMiro <nickbergeronsemail@gmail.com>
First post2011-08-06 14:00 -0700
Last post2011-08-29 04:17 -0700
Articles 2 on this page of 22 — 13 participants

Back to article view | Back to comp.lang.c++


Contents

  Why use C++? Miro <nickbergeronsemail@gmail.com> - 2011-08-06 14:00 -0700
    Re: Why use C++? jt@toerring.de (Jens Thoms Toerring) - 2011-08-06 22:29 +0000
    Re: Why use C++? SG <s.gesemann@gmail.com> - 2011-08-12 02:11 -0700
      Re: Why use C++? James Kanze <james.kanze@gmail.com> - 2011-08-21 16:44 -0700
        Re: Why use C++? Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-08-23 01:47 -0700
          Re: Why use C++? Dombo <dombo@disposable.invalid> - 2011-08-23 20:01 +0200
            Re: Why use C++? Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-09-01 02:08 -0700
          Re: Why use C++? James Kanze <james.kanze@gmail.com> - 2011-08-26 08:25 -0700
            Re: Why use C++? Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-09-01 02:43 -0700
              Re: Why use C++? James Kanze <james.kanze@gmail.com> - 2011-09-01 15:51 -0700
    Re: Why use C++? Krice <paulkp@mbnet.fi> - 2011-08-13 01:09 -0700
      Re: Why use C++? Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-08-23 02:08 -0700
      Re: Why use C++? Michael DOUBEZ <michael.doubez@free.fr> - 2011-08-23 03:33 -0700
    Re: Why use C++? Noah Roberts <roberts.noah@gmail.com> - 2011-08-27 12:38 -0700
      Re: Why use C++? "Duga Chernobyl" <duga_c3@gmx.com> - 2011-08-28 14:37 +0200
        Re: Why use C++? James Kanze <james.kanze@gmail.com> - 2011-08-29 04:11 -0700
          Re: Why use C++? Noah Roberts <roberts.noah@gmail.com> - 2011-08-29 16:25 -0700
            Re: Why use C++? Juha Nieminen <nospam@thanks.invalid> - 2011-08-30 05:57 +0000
        Re: Why use C++? Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-09-01 02:45 -0700
      Re: Why use C++? Alexei Zakharov <alexeiz+usenet@gmail.com> - 2011-08-28 17:52 -0400
        Re: Why use C++? Nobody <nobody@nowhere.com> - 2011-08-29 07:06 +0100
          Re: Why use C++? James Kanze <james.kanze@gmail.com> - 2011-08-29 04:17 -0700

Page 2 of 2 — ← Prev page 1 [2]


#9425

FromNobody <nobody@nowhere.com>
Date2011-08-29 07:06 +0100
Message-ID<pan.2011.08.29.06.06.22.456000@nowhere.com>
In reply to#9419
On Sun, 28 Aug 2011 17:52:37 -0400, Alexei Zakharov wrote:

> What I noticed is that programming in Perl allows me to express
> algorithms in a most pure and simple manner.  You would think that a
> language like C++ would be best for that kind of job.  But it turns out
> a good high-level scripting language with excelent support for basic
> data structures is better.

The main advantage of such languages over C++ is garbage collection.

If you try to write "naive" code using complex data structures in C++, you
would end up either performing many deep copies or leaking memory.

[toc] | [prev] | [next] | [standalone]


#9433

FromJames Kanze <james.kanze@gmail.com>
Date2011-08-29 04:17 -0700
Message-ID<a74a2164-dbe7-418b-a822-a94370584a62@u26g2000yqu.googlegroups.com>
In reply to#9425
On Aug 29, 7:06 am, Nobody <nob...@nowhere.com> wrote:
> On Sun, 28 Aug 2011 17:52:37 -0400, Alexei Zakharov wrote:
> > What I noticed is that programming in Perl allows me to express
> > algorithms in a most pure and simple manner.  You would think that a
> > language like C++ would be best for that kind of job.  But it turns out
> > a good high-level scripting language with excelent support for basic
> > data structures is better.

> The main advantage of such languages over C++ is garbage collection.

When appropriate, you can use garbage collection with C++.
(I've done so---it works quite well.)  The main difference
between C++ and such languages is that C++ is value oriented;
most "objects" are copiable and assignable; will be local
variables; and don't need garbage collection.

> If you try to write "naive" code using complex data structures
> in C++, you would end up either performing many deep copies or
> leaking memory.

You do end up with more deep copies.  It's inherent in the
semantics.  On the other hand, you don't get the sometimes
propagation of local changes.  (For an example, see
java.awt.Dimension.)  But at least in the code I've seen,
leaking memory generally hasn't been a problem; the real problem
which garbage collection solves (or rather, can solve, in C++)
is dangling references.

--
James Kanze

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.c++


csiph-web