Hello,
I have a question regarding variable initialization. In this sample
Code:
var val := 3;var v1 := 50 + val * 12;var v2;v2 := 50 + val * 12;
it appears that v1 is 50, whereas v2 is 86. If I replace "val" by its numeric value in init, doing
Code:
var v1 := 50 + 3 * 12;var v2;v2 := 50 + 3 * 12;
both v1 and v2 are equal to 86.
I could understand that v1 and v2 being initialized this way would mean their value is pre-calculated by the compiler during compile time, so that when they are initialized the memory is directly set to the good value. Thus, val being unavailable at compile time, it would be ignored in the first example. Even though it seems weird to me, why not. But what I don't understand is why I get no warning at all from the compiler...
A simple sample is attached.