01-Jun-2014 14:21, bearophile пишет:
Dmitry Olshansky:

Who are those people that are not disabling bounds checks in system
language ? :)

If you show D code on Reddit and you show to compile with -noboundscheck
you hear some people growl. I don't remember this happening much in
past. So I think the attitude toward disabling bound checks is changing.

-----------

Once some more logic for bound checks removal is in D, it can even be
added a @bounded expression attribute:

An expression attribute? Why turn language into a mess over this tiny problem?

It seems to me that you are considering solutions that add arbitrary amounts of complexity to solve relatively small problems.


foreach (immutable i; 0 .. a.length)
     a[@bounded i]++;

@bounded {
     foreach (immutable i; 0 .. a.length)
         a[@bounded i]++;
}

The purpose of @bounded is just to give a compile-time error if the
compiler is not able to remove one (or more if used with the {} syntax)
array bound check.

That "just" epithet is remarkable self-destruction.

--
Dmitry Olshansky

Reply via email to