Re: C vs. C++
- From: REH <spamjunk@xxxxxxxxxxx>
- Date: Sat, 17 Jan 2009 05:26:47 -0800 (PST)
On Jan 17, 6:04 am, "Malcolm McLean" <regniz...@xxxxxxxxxxxxxx> wrote:
Virtually all data is integers, reals, or strings.
Complex languages blow up the number of types and the number of ways of
arranging the types. Then you need templates to try to control the mess.
So one type of complexity is addressed by adding another layer of
complexity. Sometimes it works, more often the human programmer cannot
easily cope with the extra layers of abstraction, and the program is harder
to debug than it would have been written in a simpler language.
And when you need to create containers of these three types of yours,
templates allow you to define a single set of functions that will
operate correctly on all of them regardless of type (integer, real, or
string, or something else), and regardless of the container (array,
linked list, or something else).
I find it very amusing that the one feature of C++ that people keep
using as an example of it's complexity is templates. Templates are not
that complicated, and they make a lot of thing much simpler. With a
simple template, I can define max/min functions which work correctly
on any type, and do not suffer the problems of a macro. And in only a
few lines of code. Plus, it is very type-safe and will only allow
objects of the same type to be compared.
Granted, templates can be--and have been--abused, but so can any
language features. I don't feel that's a valid comment on the
language, but on the programmer. Look at all power a simple pointer
gives you. It's much maligned, but an extremely useful thing.
REH
.
- Follow-Ups:
- Re: C vs. C++
- From: jacob navia
- Re: C vs. C++
- From: Bartc
- Re: C vs. C++
- From: Malcolm McLean
- Re: C vs. C++
- References:
- C vs. C++
- From: beggars . banquet
- Re: C vs. C++
- From: jacob navia
- Re: C vs. C++
- From: REH
- Re: C vs. C++
- From: jacob navia
- Re: C vs. C++
- From: REH
- Re: C vs. C++
- From: jacob navia
- Re: C vs. C++
- From: CBFalconer
- Re: C vs. C++
- From: Richard
- Re: C vs. C++
- From: William Hughes
- Re: C vs. C++
- From: Richard
- Re: C vs. C++
- From: William Hughes
- Re: C vs. C++
- From: Richard
- Re: C vs. C++
- From: John Bode
- Re: C vs. C++
- From: Malcolm McLean
- Re: C vs. C++
- From: Kaz Kylheku
- Re: C vs. C++
- From: Malcolm McLean
- C vs. C++
- Prev by Date: Re: Liinear distribution of random numbers?
- Next by Date: Re: C vs. C++
- Previous by thread: Re: C vs. C++
- Next by thread: Re: C vs. C++
- Index(es):
Relevant Pages
|