user defined no bounds check

monarch_dodra monarchdodra at gmail.com
Mon Aug 20 02:45:23 PDT 2012


On Monday, 20 August 2012 at 09:10:47 UTC, Jonathan M Davis wrote:
> On Monday, August 20, 2012 10:43:43 monarch_dodra wrote:
>> There is a way to prevent bounds checking of array accesses 
>> when
>> compiling. I was wondering if there was a way to have a user
>> defined range apply the same scheme? I'd suppose using a
>> "version"? I'm not very fluent with this yet...
>
> I believe that your only options are assert, debug blocks, and 
> version blocks.
> There's no way for code to no whether -noboundscheck is used 
> just like there's
> no way for code to know whether -release is used.
>
> - Jonathan M Davis

For my personal education, what is the rationale behind not being 
able to write:
"version(noboundscheck)"
or
"version(release)"
?

Is it purposefully done to force the implementer to provide his 
own version "word" and "switch"?


More information about the Digitalmars-d-learn mailing list