Two Methods to Change Argument Variables in C++ Function Calls: Pointers and References

Two Methods to Change Argument Variables in C++ Function Calls: Pointers and References

In the previous chapter, the examples of custom function calls I provided all belong to value-based function calls. The characteristic of this type of call is that the actual parameter values are passed sequentially to the formal parameters in the called function’s parameter list. The number of actual parameters must match the number of formal … Read more

The Bridge Between C Language and Assembly Language: A Deep Understanding of Memory Operations and Function Calls

The Bridge Between C Language and Assembly Language: A Deep Understanding of Memory Operations and Function Calls

In the study of computer science, understanding how high-level languages are translated into instructions that machines can execute is a core skill. This article will analyze the correspondence between a specific C function and its corresponding x86-64 assembly code example, revealing the underlying workings of computers. Starting with a C Function The example is taken … Read more

The Correspondence Between Assembly Language and C Language

The Correspondence Between Assembly Language and C Language

The Root of the Dilemma in Understanding Assembly Language For programmers who are “native” in C/C++, reading assembly code often encounters the following difficulties: Poor Readability: Assembly instructions have a low level of abstraction and lack the expressiveness of high-level languages. Lack of Context: Low-level details such as register operations and memory accesses obscure the … Read more

Techniques to Improve the Efficiency of C Language Code

Techniques to Improve the Efficiency of C Language Code

Techniques to Improve the Efficiency of C Language Code In the process of learning and writing in C language, optimizing code to improve execution efficiency is a topic that every programmer should focus on. While the choice of algorithm has the greatest impact on performance, the author believes there are many nuances that can further … Read more

System Practice Learning ARMv8 Assembly – Course 3

System Practice Learning ARMv8 Assembly - Course 3

Course 3: Stage 2 – Core Instructions and Programming Topic:Function Calls and Stack Operations, ARMv8 Calling Conventions, Bare-Metal Programming Practice 3.1 Basics of Function Calls Core Concepts: BL Instruction: <span>BL label</span>:Jump to<span>label</span> to execute, while saving the return address (the address of the next instruction) to<span>LR</span> (X30). After the function call, return using<span>RET</span> (<span>RET</span> is … Read more

Function Calls in Embedded Systems

Function Calls in Embedded Systems

Understanding the function call process is beneficial for implementing the AUTOSAR layered architecture. 1 Memory Distribution of the Program In embedded systems, what is the internal mechanism when a function is called, and what steps are executed? As shown in Figure 1, first, let’s look at the memory distribution of a program when it is … Read more