Phlip said:
In general, >70% of all software features are not used as first delivered,
and malware is a crushing burden on global productivity. We have a new form
of war on our hands - a new kind of arms race.
Yet when you look at the sources of security breaches, over and over again
you find the things that sloppy C++ programmers revel in. Double deletes,
array overruns from unchecked buffers, runaway recursion, gratuitous
typecasts, etc.
Yes, its time that we get a good book on exactly how software can be
exploited (what to look out for). Maybe they are around. I haven't seen
one in the Bjarne Stroustrup series though, which is what I have come
to like to read.
As far as the things you've mentioned are concerned, they are quite
rare, and with a little of experience easy to spot. Simply look for
sprintf, strncpy, memcpy, memset - replace arrays with vectors, using
at() for indexing. Prohibit c-style casting (actually, prohibit C, or
tuck it away where no one can see it, testing the tucked away part well
- most legacy API's are C - hence the unfortunate need for
compatibility). I was suprised to see on a VxWorks course that none
programmed in C++. There is a lot of embedded code running out there
and still being developed every day. Most of the projects I work on
interface with the hardware very closely. Runaway recursion, hmmm -
sometimes recursion can reduce code and make it much simpler (Tower of
Hanoi, quicksort etc). Is recursion only applicable to C++ as
programming language, if so, one more reason to use it

.
Hmmm, that's Win32 for you. A good c++ implementation would hide that
as far as possible - but you know that! Yes, it compiles with a c++
compiler - so does assembler. Obviously non-standard.
People are learning that technology in their lives that fails the most often
is software. And C++ is leading the charge.
No, not C++ - the humans using it (BTW, maybe its the Win32 API with
hundreds of ways to do things and no organised documentation indicating
more correct ways). As far as stability is concerned, IMHO the standard
is pretty clear on when you should test your code before trusting it,
aside from many authoritative books written on the subject.
The biggest thing the Java guys (SUN) did was to give humans less
freedom - this cut out >50% of their problems. Leave the hard work to a
couple of guys that know how to develop software (BTW, in which
language was their VM written). Programming in sub-standard teams
before I could appreciate the value in this. This does not mean I
personally enjoy programming in C++ far more than other languages (I
have not tried D, BTW - I appreciate that they maintain templates with
similar flexibility that C++). As far as ruby is concerned, I've tried
it briefly, and it's a bit too loose for my liking. Maybe I should try
it more before commenting.
Kind regards,
W