[Robin said:]
>> C++ on the other hand
>> is a superstructure erected on the hull of C that is really just too big,
>> and which is prevented from offering the security of an advanced language
>> because of the loopholes in C.
[Jonathan said:]
[...]
> One of the problems with critiques of C++ is that very often they are
> based on an understanding of C, OOP and a quick skim through an
> introduction to the syntax of C++. Very few programs compiled with
> C++ compilers are C++ programs - mostly they are C programs (yes,
> although the languages are different, a lot of backward compatibility
> was a design goal) even if they use classes instead of structs to give a
> bit of data hiding.
I think this was Robin's point. The fact that C++ allows you to very
easily write programs which are not "C++" is a fault of the language
design. IMHO C++ would have been a lot better if it had not had to hang
onto C compatibility. All you gain by it is an atrocious syntax and the
ability to walk all over all the "good" features of C++ :-)
Yes, you can write "secure" [1] programs in C++ (as you can in C). You
can also write insecure programs in Lisp/Pop-11. However, it is *far*
easier to write insecure C/C++ programs. I fall into the class of people
who call this a language fault rather than a programmer fault... your
mileage may vary. Sane Pop-11 programmers never touches raw pointers
unless they're dealing with external code.
[1] Ok then, what I was reading "secure" to be was:
o Portable (how many Lisp/Pop-11 programs have you seen which make
incorrect assumptions about which way the stack grows, the byte
order of pointers[2], etc..... how many C/C++ programs...)
o Memory safe, ie no leaking and some guarantees on memory usage &
fragmentation.
[2] Actually...... I wrote a couple in the pre-exacc/shadowclass days
<hangs head in shame>
> Every competent (and not-so-competent) programmer that I know who has
> learnt C++, even when they are already familiar with both OOP techniques
> and with C, has found that learning C++ takes *much* longer than they
> expected. In my case, it took me about 6 months elapsed time to
> feel comfortable that I was writing C++ programs (rather than something
> that would compile through a C++ compiler: there is a big difference).
The fact that it takes 6 months should tell you something about the
language design me'thinks :-)
I suppose I should also point out that I'm also one of those people who
rant about C++ without having used it a great deal. I played with it two
or three years ago for about a month and didn't think it was worth the
effort. Sorry :-)
aids (adrianh@cogs.susx.ac.uk) ObDisclamer: Poplog used to pay my wages
Phone: +44 (0)273 678367 URL: http://www.cogs.susx.ac.uk/users/adrianh/
|