On 12/8/2013 4:47 PM, Timon Gehr wrote:
Static analysis will tell you where a pointer might point to (more importantly,
it may exclude aliasing) and what values the variable 'i' might have in it. How
precise this information is hinges on the details of the analysis and the
program it is applied on. I'm just saying that this may be more precise than
what 'immutable' qualifiers give you (since those are quite easy to infer, given
the program, and alias analysis may be non-trivial.)

There has been a lot of work trying to eliminate array bounds checking by figuring out the limits of i. This has met with only limited success.

I know of no C compiler that even attempts such things, and it certainly would be done if it was trivial.

"Proper" D code makes routine use of const and immutable, and so that information is effortlessly available to even simple optimizers.

Reply via email to