On 12/8/2013 2:13 AM, Araq wrote:
From this list only (7) is a valid point. All the others can be trivially dealt
with whole program optimization (1,2,3)

If it's trivial, it's not happening. (1) would require solving the halting problem. (2) is impractical because there's no way for the programmer to detect if his call stack is pure or not, so he can't reasonably fix it to make it pure. (3) does require whole program analysis, which is done (as I said) by the linker, and is not normally done. Will gcc/ld do it? Nope. (It's not so trivial.)

or coding conventions (4,5,6) (always
pass a (char*, len) pair around for efficient slicing).

(4) just try retrofitting an existing C program to do this. I have. You'll give it up soon :-)

(5) it just doesn't happen in C code - it's too hard

(6) I pretty much never see this happening in real C code - it's not so trivial


Interestingly, things
that are encouraged in Ada (this is an array of integers of range 0..30, see
value range propagation) are much harder to recompute with whole program
optimization and D lacks them.

You can do these in D with a library type.

Reply via email to