freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

chapter9subprograms(已修改)

2025-10-10 21:57 本頁面
 

【正文】 91 Chapter 9 Subprograms Topics ? Fundamentals of Subprograms ? Design Issues for Subprograms ? Local Referencing Environments ? ParameterPassing Methods ? Parameters that are Subprogram Names ? Overloaded Subprograms ? Generic Subprograms ? Design Issues for Functions ? UserDefined Overloaded Operators ? Coroutines 92 Introduction ? Two fundamental abstraction facilities – Process abstraction (this chapter) – Data abstraction (Chapter 11) 93 Fundamentals of Subprograms ? General characteristics of subprograms: 1. A subprogram has a single entry point 2. The caller is suspended during execution of the called subprogram 3. Control always returns to the caller when the called subprogram’s execution terminates 94 Fundamentals of Subprograms ? Basic definitions: – A subprogram call is an explicit request that the subprogram be executed – A subprogram header is the first line of the definition, including the name, the kind of subprogram, and the formal parameters – The parameter profile of a subprogram is the number, order, and types of its parameters 95 Fundamentals of Subprograms ? Basic definitions (continued): – The protocol of a subprogram is its parameter profile plus, if it is a function, its return type – A subprogram declaration provides the protocol, but not the body, of the subprogram – A formal parameter is a dummy variable listed in the subprogram header and used in the subprogram – An actual parameter represents a value or address used in the subprogram call statement 96 Fundamentals of Subprograms ? Actual/Formal Parameter Correspondence: 1. Positional 2. Keyword – . SORT(LIST = A, LENGTH = N)。 – Advantage: order is irrelevant – Disadvantage: user must know the formal parameter’s names – Default Values: . procedure SORT(LIST : LIST_TYPE。 LENGTH : INTEGER := 100)。 ... SORT(LIST = A)。 97 Fundamentals of Subprograms ? Procedures provide userdefined statements ? Functions provide userdefined operators 98 Design Issues for Subprograms 1. What parameter passing methods are provided? 2. Are parameter types checked?( actual Ps against with the formal Ps) 3. Are local variables static or dynamic? 4. Can subprogram definitions appear in other subprogram definitions? 5. What is the referencing environment of a passed subprogram? 6. Can subprograms be overloaded? 7. Are subprograms allowed to be generic? 8. Is either separate or independent pilation possible? 99 Local referencing environments ? If local variables are stackdynamic: – Advantages: a. Support for recursion b. Storage for locals is shared among some subprograms – Disadvantages: a. Allocation/deallocation time b. Indirect addressing c. Subprograms cannot be history sensitive ? Static locals are the opposite 910 Local referencing environments ? Language Examples: 1. FORTRAN 77 and 90 most are static, but the implementor can choose either (User can force static with SAVE) 2. C both (variables declared to be static are) (default is stack dynamic) 3. Pascal, Java, and Ada dynamic only 911 Parameter Passing Methods ? We discuss these at several different levels: – Semantic models: in mode, out mode, inout mode – Conceptual model
點擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫吧 www.dybbs8.com
公安備案圖鄂ICP備17016276號-1