On Thursday, October 14, 2010 16:49:58 bearophile wrote: > Nick Sabalausky: > > Then you're wasting cycles every iteration (by doing an extra addition > > and maybe an extra shift or even multiplication depending on T: Ie, > > (cast(ubyte*)myArray.ptr) + i * T.sizeof). That was a pretty common > > inner-loop optimization back in my C days. > > With D sometimes array-based code is faster than pointer-based. With LDC > they are usually equally efficient. > > > Plus, I've never once done pointer arithmetic accidentally in D, so I > > don't see any safety to be gained from not allowing it. > > I think they are trying to design a safer language. Pointer arithmetic is > well known to be error-prone. (I have never asked to remove pointer > arithmetic from D).
There's nothing wrong with a language not having pointer arithmetic. It is an error-prone feature (hence why it's banned in SafeD) and many languages don't need it and don't have it. However, it's hard to see how a language can claim to be a systems programming language and not allow pointer arithmetic. I really need to sit down and take a good look at Go one of these days, but the more I hear about it, the less it looks like a systems programming language. They also clearly have a _very_ different approach from D, and I'd expect that the types of people who like Go wouldn't like D and vice-versa. I still need to take a good look at one of these days though. - Jonathan M Davis
