728x90
- A switch statement provides a multiway branching capability based on the value of an integer index.
- They are particularly useful when dealing with tests where there can be a large number of possible outcomes.
- The advantage of using a jump table over a long sequence of if-else statements is that the time taken to perform the switch is independent of the number of switch cases.
- The array jt contains seven entries, each of which is the address of a block of code. These locations are defined by labels in the code and indicated in the entries in jt by code pointers, consisting of the labels prefixed by &&.
- Examining all of this code requires careful study, but the key point is to see that the use of a jump table allows a very efficient way to implement a multiway branch
728x90
'csapp' 카테고리의 다른 글
3.7.4 Local Storage on the Stack (0) | 2023.04.18 |
---|---|
3.7.1 The Run-Time Stack (2) | 2023.04.18 |
3.6.7 Loops (0) | 2023.04.14 |
3.6.5 Implementing Conditional Branches with Conditional Control (0) | 2023.04.13 |
3.6 Control (0) | 2023.04.10 |
댓글