C/C++ style Crashes?

Steve Horne stephenwantshornenospam100 at aol.com
Mon Jan 8 09:46:08 PST 2007


On Mon, 08 Jan 2007 02:15:09 +0100, Alexander Panek
<a.panek at brainsware.org> wrote:

>> I'd like to know if it solves this problem, Java and C# don't allow such access.
>
>Sure.

No, D does not solve this problem. You can cast pointers and do
pointer arithmetic in D if you want to.

This is important. Java is a limited languages because it makes code
'more reliable' by eliminating needed features. In reality, this
doesn't make things more reliable since you then have to work around
the limitations or simply accept that there are things that you can't
do.

In a systems language, pointer arithmetic is a necessity. There are
things you simply cannot do without it - data structures that require
it, for instance. It's all very well saying that you have lists and
hashes built in, but while these are very powerful and can do a lot,
they are not sufficient for handling every requirement especially when
efficiency (both speed and memory) is a major concern.

A reasonable analogy would be that it's like trying to improve road
safety by banning cars. Cars are dangerous so surely banning them
would improve safety, after all? Well, maybe, but only by making many
journeys impossible and by wasting a great deal of time on many
others. And its worth bearing in mind that there are far more
dangerous ways to travel than in a car.

Besides, the damage done to the economy would mean that less money is
available, which means that you can't afford health care, police, fire
and rescue services, etc etc. Whoops - not so great after all.

Sometimes, the lack of the ability to do pointer arithmetic is very
much like that. You end up having to do a lot of work to work around
the limitation. You don't get the gains that doing pointer arithmetic
can provide, and the knock-on issues in terms of development time and
code efficiency make the whole project far more difficult. And the
loss of those code efficiency gains mean you have to look elsewhere
for efficiency gains to compensate, causing further development time
issues.

Funny thing. My father is a builder. He handles dangerous tools every
day. Hundreds of them. We programmers like to consider ourselves more
intelligent than builders, and yet we are like toddlers who need
safety gates on the stairs - god help the person who suggests that we
should know how and when to climb the stairs safely.

It should be pretty obvious by now that this kind of stuff really
pisses me off. Its pathetic. Before long, Eclipse is probably going to
have a 'safety feature' that refuses to let you write any code until
you strap yourself safely into your chair. And ten minutes after you
start, it'll offer to change your nappy. In the past, you used to get
fired for wanting to go home at 7PM. Give it a year or two and by 7PM
your IDE will be tucking you into bed and reading you fairy stories.

-- 
Remove 'wants' and 'nospam' from e-mail.



More information about the Digitalmars-d mailing list