built-in array ptrEnd
Jonathan M Davis
jmdavisProg at gmx.com
Mon Sep 17 10:42:11 PDT 2012
On Monday, September 17, 2012 13:11:30 Andrei Alexandrescu wrote:
> To be blunt, I think this is a terrible idea for a convenience function.
> Note that I'm only allowing myself to say this because monarch_dodra has
> clearly made other excellent contributions so I assume his ideas can
> take a bit of a destruction.
>
> Normal code isn't supposed to mess with pointers and stuff, particularly
> with pointers past the end of arrays. That's rare. If Phobos uses .ptr
> with any frequency it's because it's low-level code that should optimize
> for performance compulsively.
I concur. Pointer arithmetic should be rare (particularly outside of Phobos),
and ptrEnd does almost nothing for you. It just slightly shortens code for a
rare use case. It's not worth it.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list