Concepts of Programming Languages
400 Chapter 9 Subprograms consider the design considerations that face a language designer in choosing among the methods. 9.5.1 ...
9.5 Parameter-Passing Methods 401 9.5.2.1 Pass-by-Value When a parameter is passedby value, the value of the actual parameter is ...
402 Chapter 9 Subprograms their corresponding actual parameter last becomes the value of p1 in the caller. Thus, the order in wh ...
9.5 Parameter-Passing Methods 403 9.5.2.3 Pass-by-Value-Result Pass-by-value-result is an implementation model for inout-mode pa ...
404 Chapter 9 Subprograms void fun(int &first, int &second) If the call to fun happens to pass the same variable twice, ...
9.5 Parameter-Passing Methods 405 formal parameter in all its occurrences in the subprogram. This method is quite different from ...
406 Chapter 9 Subprograms Access to the formal parameters in the called subprogram is by indirect addressing from the stack loca ...
9.5 Parameter-Passing Methods 407 void fun(const int &p1, int p2, int &p3) {... } where p1 is pass-by-reference but cann ...
408 Chapter 9 Subprograms corresponding actual parameter (the number of actual parameters need not be the same as the number of ...
9.5 Parameter-Passing Methods 409 representations of these two are very different. sub1 cannot produce a correct result given an ...
410 Chapter 9 Subprograms A call to printf must include at least one parameter, a pointer to a literal character string. Beyond ...
9.5 Parameter-Passing Methods 411 parameter, the formal parameter must include the number of columns in the second pair of brack ...
412 Chapter 9 Subprograms size of the dimensions of all arrays that are used as parameters at the time subpro- grams are compile ...
9.5 Parameter-Passing Methods 413 then both the defined index sizes and the filled index sizes can be passed to the subprogram. ...
414 Chapter 9 Subprograms Contemporary software-engineering principles dictate that access by sub- program code to data outside ...
9.5 Parameter-Passing Methods 415 We can modify the C swap function to deal with pointer parameters to achieve the effect of pas ...
416 Chapter 9 Subprograms Suppose swap3 is called with swap3(c, d); The actions of swap3 with this call are addr_c = &c — Mo ...
9.6 Parameters That Are Subprograms 417 list[i] = 5; fun(i, list[i]); } In fun, if pass-by-reference is used, i and a are aliase ...
418 Chapter 9 Subprograms Fortran 95+ has a mechanism for providing types of parameters for subpro- grams that are passed as par ...
9.7 Calling Subprograms Indirectly 419 the environment in which the procedure appears as a parameter has no natural connection t ...
«
17
18
19
20
21
22
23
24
25
26
»
Free download pdf