No bounds checking for dynamic arrays at compile time?

Jonathan M Davis jmdavisProg at gmx.com
Fri Dec 14 00:36:47 PST 2012


On Friday, December 14, 2012 08:34:44 Jacob Carlborg wrote:
> On 2012-12-13 22:26, Walter Bright wrote:
> > CTFE would catch it.
> 
> Didn't you just say that flow analysis is needed for that?

No. You'd get a RangeError in CTFE just like you'd get at runtime. It's just 
that the function is being run at compile time instead of runtime. What would 
require flow analysis would be to statically determine that there was an 
indexing problem. It's the difference between examining the code to determine 
whether it has a problem and running it to see if it has a problem.

- Jonathan M Davis


More information about the Digitalmars-d mailing list