On 7/29/2014 4:03 PM, bearophile wrote:
How do you do this with no additional language features?

Data flow analysis can figure that example out. If it can't for a more complex one, you can do:

  assert(x >= 0 && x <= 255);
  assert(y >= 0 && y <= 255);

The optimizer can certainly use asserts to provide semantic information (even though the dmd one doesn't at the moment).


Again, I know you like reading about new languages and language features. I think you'd enjoy that even more supplemented with a book on how compilers work internally, in particular, how data flow analysis works and what it can do.

Reply via email to