Why does a comma expression return the result of the last expression? -From another perspective, C ++

Source: Internet
Author: User

Auto V = func1 (), func2 (), func3 ();

This is because a function call requires parameter pressure stacks, calls are complete, and there is also a process of rollback (stack cleaning.
The stack rollback can be performed by the caller or the called, so there are two different call conventions:
_ Cdecl and _ stdcall, of course this is far away. The register is also used to eliminate the unique thiscall of the fastcall and C ++ of the stack.
Because function calling is a process that constantly goes into and out of the stack, the comma expression returns the result of the last expression.
Otherwise, if the result of the first expression is returned, where is the result stored?


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.