Array bound checks removal increasing importance

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 3 15:10:24 PDT 2014


Kagamin:

> Scientific programs usually process trusted data (or easily 
> validated), so they may need correctness checks, but don't need 
> security checks.

I agree.


> If you see the algorithm works with bound checks, you can turn 
> them off.

Algorithms go in different code paths, so different runs hit the 
arrays differently. In scientific code you have to trust the 
correctness of the results. So you prefer to leave array bound 
checks active (as in Java, Julia, Python). If your compiler is 
able to remove some bound checks and mechanically verify the code 
as safe, that's even better (as in Java, and probably in future 
Julia). If you give me a compiler able to remove most array bound 
checks safely, you will see me never disable them blindly again 
:-)

Bye,
bearophile


More information about the Digitalmars-d mailing list