Order of evaluation of arguments in function calling?

前端 未结 6 1475
感情败类
感情败类 2020-12-10 14:29

I am studying about undefined behavior in C and I came to a statement that states that

there is no particular order of evaluation of function argume

6条回答
  •  青春惊慌失措
    2020-12-10 15:23

    since the C standard does not specify any order for evaluating parameters, every compiler implementation is free to adopt one. That's one reason why coding something like foo(i++) is complete insanity- you may get different results when switching compilers.

    One other important thing which has not been highlighted here - if your favorite ARM compiler evaluates parameters left to right, it will do so for all cases and for all subsequent versions. Reading order of parameters for a compiler is merely a convention...

提交回复
热议问题