Disallow arrays as pointers

bearophile bearophileHUGS at lycos.com
Sun Oct 30 18:49:05 PDT 2011


Timon Gehr:

> A lot of C's carefully designed syntactic elegance is 
> lost when going from pointers/iterators to arrays and ranges.

I think that a large part of that C syntactic elegance is an illusion. From my experience, I want my code to look very simple to read and clean every time this is possible. I want it to be easy to port to other languages, because I have do it often enough. C code that uses lot of pointers is often bug-prone, messy and hard to safely translate to other languages.

There are situation where pointers are necessary or are better than the alternatives, or they give the needed flexibility, so I prefer a language with pointers, but in a well designed language those situations are not common, and I think raw pointers should be avoided when they are not needed. I have debugged enough C code to be rather sure of this. Good luck with your pointers.

Bye,
bearophile


More information about the Digitalmars-d mailing list