Order of evaluation of arguments in function calling?

前端 未结 6 1477
感情败类
感情败类 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 14:59

    Argument evaluation and argument passing are related but different problems.

    Arguments tend to be passed left to right, often with some arguments passed in registers rather than on the stack. This is what is specified by the ABI and _cdecl and _stdcall.

    The order of evaluation of arguments before placing them in the locations that the function call requires is unspecified. It can evaluate them left to right, right to left, or some other order. This is compiler dependent and may even vary depending on optimization level.

提交回复
热议问题