When is stack space allocated for local variables?

前端 未结 5 2069
独厮守ぢ
独厮守ぢ 2021-01-02 02:54

I have a question about the following C code:

void my_function()
{
    int i1;
    int j1;

    // Do something...

    if (check_something())
    {
                 


        
5条回答
  •  清酒与你
    2021-01-02 03:31

    The compiler is free to do whatever it wants, as long as the semantics of the language are reserved. In other words, i2 and j2 can be bound to memory places before the execution reaches the entry point of their block, and can be unbounded any time as long as that doesn't affect the semantics of your code.

提交回复
热议问题