How does the function work--partition RAM do not understand Ah???

Source: Internet
Author: User

1, see "21 days to learn C + +" P92 function principle of division RAM, feeling or vaguely, not quite understand, further inquiry???

2, when the program starts, the operating system (such as dos,windows, etc.) will be based on the requirements of the compiler to set a variety of memory areas.

A common concern for a C + + programmer is the global namespace, free memory, registers, code spaces, and stacks.

3. Register: A special Storage area in the CPU, the register of the Register group that points to the next line of code at any given moment is called the instruction pointer. The task of the instruction pointer is to track which line of code will be executed next.

4, Code space: the code itself is stored in the code space, each line of code is converted into a series of binary forms of instruction, and then stored in the code space. The instruction pointer holds the address of the instruction to be executed next.

5, Stack: used to store each function in the program to say the required data, the stack is in-first out, in sharp contrast with the first-in, first-out queue. A stack is a function call that pushes the required parameters of the called function into the stack to implement a function call.

The specific role of the stack:

1, passing parameters (providing parameters for the called function)

2, saving local variables

3, Save intermediate variables

4. Save the State of the task (for example, the value of each register) in the system with a stack

6, then explain the stack and function call this piece can not understand??

How does the function work--partition RAM do not understand Ah???

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.