implicite deref on array element access? (indexing)
Steven Schveighoffer
schveiguy at yahoo.com
Fri Feb 25 08:09:58 PST 2011
On Fri, 25 Feb 2011 10:58:49 -0500, Andrej Mitrovic
<andrej.mitrovich at gmail.com> wrote:
> On 2/25/11, Steven Schveighoffer <schveiguy at yahoo.com> wrote:
>> Fun fact, you can avoid array bounds checks (if you know the index is
>> valid) by doing arr.ptr[n]
>
> Can't you do the same with -noboundscheck ?
No, -noboundscheck stops bounds checking everywhere. arr.ptr[n] stops
bounds checking for that one statement. It's a lot easier to prove that
one time that bounds checking is not necessary than it is to prove that no
bounds checking is necessary anywhere.
Plus, you can't always control the command line.
-Steve
More information about the Digitalmars-d-learn
mailing list