user defined no bounds check

Jonathan M Davis jmdavisProg at gmx.com
Mon Aug 20 08:37:10 PDT 2012


On Monday, August 20, 2012 12:44:40 monarch_dodra wrote:
> Andrei says something in his book along the lines of "If a built
> in can do it, so should a user defined type" (don't have the
> quote here though, sorry). So basically, if a built in array can
> conditionally control bounds checking, why can't a user defined
> range do it?

Except that generally assert does the job just fine. The only reason that -
noboundscheck is any different really is the fact that bounds checking is left 
on in @safe code even with -release. It just seems overkill to me try and have 
user-defined types act the same way. It's arguably bad enough that arrays work 
this way.

If you want control user-defined types with a version(noboundscheck), then 
create an enhancement request, and maybe Walter will think that it's a good 
idea. I don't know. It seems completely unnecessary to me, but that doesn't 
mean that it won't happen.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list