728x90
- The syntax of a union declaration is identical to that for structures, but its semantics are very different
- A common method is to introduce an enumer- ated type defining the different possible choices for the union, and then create a structure containing a tag field and the union:
- Unions can also be used to access the bit patterns of different data types
3.9.3 Data Alignment
- The x86-64 hardware will work correctly regardless of the alignment of data. However, Intel recommends that data be aligned to improve memory system performance.
- As a result, j has offset 8, and the overall structure size is 12 bytes. Furthermore, the compiler must ensure that any pointer p of type struct S1* satisfies a 4-byte alignment.
3.10 Combining Control and Data in Machine-Level Programs
3.10.1 Understanding Pointers
- Every pointer has an associated type
- Every pointer has a value.
- Pointers are created with the ‘&’ operator.
- Pointers are dereferenced with the ‘*’ operator.
- Arrays and pointers are closely related.
- Casting from one type of pointer to another changes its type but not its value.
- Pointers can also point to functions.
728x90
'csapp' 카테고리의 다른 글
4.1 The Y86-64 Instruction Set Architecture (0) | 2023.05.02 |
---|---|
Stack Corruption Detection (0) | 2023.04.28 |
3.8.3 Nested Arrays (0) | 2023.04.19 |
3.7.4 Local Storage on the Stack (0) | 2023.04.18 |
3.7.1 The Run-Time Stack (2) | 2023.04.18 |
댓글