3 ms·
> The peephole optimiser will pretty certainly run first That's what I'm trying to avoid though. The whole "pretty certainly" thing. The compiler will "pretty
by TheLoneWolfling 12y ago
> The peephole optimiser will pretty certainly run first
That's what I'm trying to avoid though. The whole "pretty certainly" thing. The compiler will "pretty certainly" do not optimize this. The compiler will "pretty certainly" optimize that.
And then compiler versions change and people get bitten. Time and time again.
You're misinterpreting what I'm trying to say w.r.t. uninitialized variables here, or perhaps I'm just being idiotic at explaining myself.
In what I'm describing, the compiler can assume the value of x to be anything it wishes. It's just that, once the value is fixed, it must be fixed.
Think of it this way: the compiler may choose any initial value of any variable it chooses.
I'm proposing a language where a read from an uninitialized variable must be consistent with the uninitialized variable having been set to an arbitrary value (in range) before the first read from it. So compiling the static code {int x; return x;} into {return 0;} is perfectly allowed, as is compiling it into {return 42;}.