callbyreferenceWord下载.docx
《callbyreferenceWord下载.docx》由会员分享,可在线阅读,更多相关《callbyreferenceWord下载.docx(11页珍藏版)》请在冰点文库上搜索。
![callbyreferenceWord下载.docx](https://file1.bingdoc.com/fileroot1/2023-4/29/8b38cf20-da8b-4a26-a078-3e58e73dfb49/8b38cf20-da8b-4a26-a078-3e58e73dfb491.gif)
Clause3:
(that=tasks)youmightwantafunctiontoperform.
Analysis:
S+V:
Themechanismisnot
C:
Q:
E:
Themechanismisnotsufficient
Thecall-by-valuemechanismisnotsufficient
Thecall-by-valuemechanismisnotsufficientforalltasks
weused
that(=mechanism)weused
that(=mechanism)weuseduntilnow
youmightwant
youmightwantafunction
(that=tasks)youmightwantafunctiontoperform.
Finaltranslation:
TOP
Forexample,onecommontaskforafunctionistoobtainaninputvaluefromtheuserandsetthevalueofanargumentvariabletothisinputvalue.
onecommontaskis
onecommontaskforafunctionis
onecommontaskforafunctionistoobtainandset
onecommontaskforafunctionistoobtainaninputvalueandset
onecommontaskforafunctionistoobtainaninputvaluefromtheuserandset
onecommontaskforafunctionistoobtainaninputvaluefromtheuserandsetthevalueofanargumentvariable
onecommontaskforafunctionistoobtainaninputvaluefromtheuserandsetthevalueofanargumentvariabletothisinputvalue.
Forexample,onecommontaskforafunctionistoobtainaninputvaluefromtheuserandsetthevalueofanargumentvariabletothisinputvalue.
Withthecall-by-valueformalparametersthatwehaveuseduntilnow,acorrespondingargumentinafunctioncallcanbeavariable,butthefunctiontakesonlythevalueofthevariableanddoesnotchangethevariableinanyway.
Withthecall-by-valueformalparametersacorrespondingargumentinafunctioncallcanbeavariable,
that(=call-by-value_formal_parameters)wehaveuseduntilnow,
butthefunctiontakesonlythevalueofthevariableanddoesnotchangethevariableinanyway.
acorrespondingargumentcanbe
acorrespondingargumentcanbeavariable,
acorrespondingargumentinafunctioncallcanbeavariable,
Withthecall-by-valueformalparametersacorrespondingargumentinafunctioncallcanbeavariable,
wehaveused
that(=call-by-value_formal_parameters)wehaveused
that(=call-by-value_formal_parameters)wehaveuseduntilnow,
butthefunctiontakesanddoesnotchange
butthefunctiontakesonlythevalueanddoesnotchange
butthefunctiontakesonlythevalueofthevariableanddoesnotchange
butthefunctiontakesonlythevalueofthevariableanddoesnotchangethevariable
butthefunctiontakesonlythevalueofthevariableanddoesnotchangethevariableinanyway.
Withacall-by-valueformalparameteronlythevalueoftheargumentissubstitutedfortheformalparameter.
AissubstitutedforB的意思是A被用來取代B。
(主動語氣的說法是substituteAforB)
onlythevalueissubstituted
onlythevalueissubstitutedfortheformalparameter.
onlythevalueoftheargumentissubstitutedfortheformalparameter.
Withacall-by-valueformalparameteronlythevalueoftheargumentissubstitutedfortheformalparameter.
Foraninputfunction,youwantthevariable(notthevalueofthevariable)tobesubstitutedfortheformalparameter.
youwant
youwantthevariable
youwantthevariabletobesubstituted
youwantthevariabletobesubstitutedfortheformalparameter.
youwantthevariable(notthevalueofthevariable)tobesubstitutedfortheformalparameter.
Foraninputfunction,youwantthevariable(notthevalueofthevariable)tobesubstitutedfortheformalparameter.
Thecall-by-referencemechanismworksinjustthisway.
Themechanismworks
Thecall-by-referencemechanismworks
Thecall-by-referencemechanismworksinthisway.
Thecall-by-referencemechanismworksinjustthisway.
Withacall-by-referenceformalparameter,thecorrespondingargumentinafunctioncallmustbeavariable,andthisargumentvariableissubstitutedfortheformalparameter.
Withacall-by-referenceformalparameter,thecorrespondingargumentinafunctioncallmustbeavariable,
andthisargumentvariableissubstitutedfortheformalparameter.
thecorrespondingargumentmustbe
thecorrespondingargumentinafunctioncallmustbe
thecorrespondingargumentinafunctioncallmustbeavariable,
Withacall-by-referenceformalparameter,thecorrespondingargumentinafunctioncallmustbeavariable,
andthisargumentvariableissubstituted
andthisargumentvariableissubstitutedfortheformalparameter.
Itisalmostasiftheargumentvariablewereliterallycopiedintothebodyofthefunctiondefinitioninplaceoftheformalparameter.
Itisalmost(sth=as_if...)
asiftheargumentvariablewereliterallycopiedintothebodyofthefunctiondefinitioninplaceoftheformalparameter.
Itis
Itis(sth=as_if...)
asiftheargumentvariablewerecopied
asiftheargumentvariablewerecopiedintothebody
asiftheargumentvariablewerecopiedintothebodyofthefunctiondefinition
asiftheargumentvariablewerecopiedintothebodyofthefunctiondefinitioninplaceoftheformalparameter.
asiftheargumentvariablewereliterallycopiedintothebodyofthefunctiondefinitioninplaceoftheformalparameter.
Aftertheargumentissubstitutedin,thecodeinthefunctionbodyisexecutedandcanchangethevalueoftheargumentvariable.
Aftertheargumentissubstitutedin,
thecodeinthefunctionbodyisexecutedandcanchangethevalueoftheargumentvariable.
Aftertheargumentissubstituted
Aftertheargumentissubstitutedin,
thecodeisexecutedandcanchange
thecodeinthefunctionbodyisexecutedandcanchange
thecodeinthefunctionbodyisexecutedandcanchangethevalue
thecodeinthefunctionbodyisexecutedandcanchangethevalueoftheargumentvariable.