No bounds checking for dynamic arrays at compile time?
H. S. Teoh
hsteoh at quickfur.ath.cx
Fri Dec 14 07:19:59 PST 2012
On Fri, Dec 14, 2012 at 04:08:09PM +0100, Paulo Pinto wrote:
> On Friday, 14 December 2012 at 08:40:59 UTC, Walter Bright wrote:
> >On 12/13/2012 11:34 PM, 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?
> >>
> >
> >CTFE executes at compile time, no flow analysis is needed for
> >that. DFA is something very different - it "executes" all paths
> >simultaneously.
>
> What is the issue with flow analysis and D?
>
> Even on the toy compiler I had to create back in the university we
> implemented flow analysis for a few use cases.
>
> So the question is if toy university compilers have flow analysis
> why not having it in D?
[...]
Yeah I'm curious about this too. I also have implemented basic flow
analysis in a compiler project in university. For the simple cases, it
doesn't complicate the compiler that much at all. For a sophisticated
compiler such as DMD, basic flow analysis would almost seem trivial.
(But then again, it may add performance bottlenecks that I'm unaware of
-- this was before I learnt the hard way that hotspots often aren't
actually where you think they are.)
T
--
Acid falls with the rain; with love comes the pain.
More information about the Digitalmars-d
mailing list