callbyreference.docx

上传人:b****1 文档编号:569179 上传时间:2023-04-29 格式:DOCX 页数:11 大小:15.23KB
下载 相关 举报
callbyreference.docx_第1页
第1页 / 共11页
callbyreference.docx_第2页
第2页 / 共11页
callbyreference.docx_第3页
第3页 / 共11页
callbyreference.docx_第4页
第4页 / 共11页
callbyreference.docx_第5页
第5页 / 共11页
callbyreference.docx_第6页
第6页 / 共11页
callbyreference.docx_第7页
第7页 / 共11页
callbyreference.docx_第8页
第8页 / 共11页
callbyreference.docx_第9页
第9页 / 共11页
callbyreference.docx_第10页
第10页 / 共11页
callbyreference.docx_第11页
第11页 / 共11页
亲,该文档总共11页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

callbyreference.docx

《callbyreference.docx》由会员分享,可在线阅读,更多相关《callbyreference.docx(11页珍藏版)》请在冰点文库上搜索。

callbyreference.docx

callbyreference

[Savitch,p.137]Thecall-by-valuemechanismthatweuseduntilnowisnotsufficientforalltasksyoumightwantafunctiontoperform.Forexample,onecommontaskforafunctionistoobtainaninputvaluefromtheuserandsetthevalueofanargumentvariabletothisinputvalue.Withthecall-by-valueformalparametersthatwehaveuseduntilnow,acorrespondingargumentinafunctioncallcanbeavariable,butthefunctiontakesonlythevalueofthevariableanddoesnotchangethevariableinanyway.Withacall-by-valueformalparameteronlythevalueoftheargumentissubstitutedfortheformalparameter.Foraninputfunction,youwantthevariable(notthevalueofthevariable)tobesubstitutedfortheformalparameter.Thecall-by-referencemechanismworksinjustthisway.Withacall-by-referenceformalparameter,thecorrespondingargumentinafunctioncallmustbeavariable,andthisargumentvariableissubstitutedfortheformalparameter.Itisalmostasiftheargumentvariablewereliterallycopiedintothebodyofthefunctiondefinitioninplaceoftheformalparameter.Aftertheargumentissubstitutedin,thecodeinthefunctionbodyisexecutedandcanchangethevalueoftheargumentvariable.

Originalsentence:

Thecall-by-valuemechanismthatweuseduntilnowisnotsufficientforalltasksyoumightwantafunctiontoperform.

Extracomments:

Clause1:

Thecall-by-valuemechanismisnotsufficientforalltasks

Clause2:

that(=mechanism)weuseduntilnow

Clause3:

(that=tasks)youmightwantafunctiontoperform.

Analysis:

Clause1:

Thecall-by-valuemechanismisnotsufficientforalltasks

S+V:

Themechanismisnot

C:

Q:

E:

Themechanismisnotsufficient

C:

Q:

E:

Thecall-by-valuemechanismisnotsufficient

C:

Q:

E:

Thecall-by-valuemechanismisnotsufficientforalltasks

C:

Clause2:

that(=mechanism)weuseduntilnow

S+V:

weused

C:

Q:

E:

that(=mechanism)weused

C:

Q:

E:

that(=mechanism)weuseduntilnow

C:

Clause3:

(that=tasks)youmightwantafunctiontoperform.

S+V:

youmightwant

C:

Q:

E:

youmightwantafunction

C:

Q:

E:

(that=tasks)youmightwantafunctiontoperform.

C:

Finaltranslation:

TOP

Originalsentence:

Forexample,onecommontaskforafunctionistoobtainaninputvaluefromtheuserandsetthevalueofanargumentvariabletothisinputvalue.

Extracomments:

S+V:

onecommontaskis

C:

Q:

E:

onecommontaskforafunctionis

C:

Q:

E:

onecommontaskforafunctionistoobtainandset

C:

Q:

E:

onecommontaskforafunctionistoobtainaninputvalueandset

C:

Q:

E:

onecommontaskforafunctionistoobtainaninputvaluefromtheuserandset

C:

Q:

E:

onecommontaskforafunctionistoobtainaninputvaluefromtheuserandsetthevalueofanargumentvariable

C:

Q:

E:

onecommontaskforafunctionistoobtainaninputvaluefromtheuserandsetthevalueofanargumentvariabletothisinputvalue.

C:

Q:

E:

Forexample,onecommontaskforafunctionistoobtainaninputvaluefromtheuserandsetthevalueofanargumentvariabletothisinputvalue.

C:

Finaltranslation:

TOP

Originalsentence:

Withthecall-by-valueformalparametersthatwehaveuseduntilnow,acorrespondingargumentinafunctioncallcanbeavariable,butthefunctiontakesonlythevalueofthevariableanddoesnotchangethevariableinanyway.

Extracomments:

Clause1:

Withthecall-by-valueformalparametersacorrespondingargumentinafunctioncallcanbeavariable,

Clause2:

that(=call-by-value_formal_parameters)wehaveuseduntilnow,

Clause3:

butthefunctiontakesonlythevalueofthevariableanddoesnotchangethevariableinanyway.

Analysis:

Clause1:

Withthecall-by-valueformalparametersacorrespondingargumentinafunctioncallcanbeavariable,

S+V:

acorrespondingargumentcanbe

C:

Q:

E:

acorrespondingargumentcanbeavariable,

C:

Q:

E:

acorrespondingargumentinafunctioncallcanbeavariable,

C:

Q:

E:

Withthecall-by-valueformalparametersacorrespondingargumentinafunctioncallcanbeavariable,

C:

Clause2:

that(=call-by-value_formal_parameters)wehaveuseduntilnow,

S+V:

wehaveused

C:

Q:

E:

that(=call-by-value_formal_parameters)wehaveused

C:

Q:

E:

that(=call-by-value_formal_parameters)wehaveuseduntilnow,

C:

Clause3:

butthefunctiontakesonlythevalueofthevariableanddoesnotchangethevariableinanyway.

S+V:

butthefunctiontakesanddoesnotchange

C:

Q:

E:

butthefunctiontakesonlythevalueanddoesnotchange

C:

Q:

E:

butthefunctiontakesonlythevalueofthevariableanddoesnotchange

C:

Q:

E:

butthefunctiontakesonlythevalueofthevariableanddoesnotchangethevariable

C:

Q:

E:

butthefunctiontakesonlythevalueofthevariableanddoesnotchangethevariableinanyway.

C:

Finaltranslation:

TOP

Originalsentence:

Withacall-by-valueformalparameteronlythevalueoftheargumentissubstitutedfortheformalparameter.

Extracomments:

AissubstitutedforB的意思是A被用來取代B。

(主動語氣的說法是substituteAforB)

S+V:

onlythevalueissubstituted

C:

Q:

E:

onlythevalueissubstitutedfortheformalparameter.

C:

Q:

E:

onlythevalueoftheargumentissubstitutedfortheformalparameter.

C:

Q:

E:

Withacall-by-valueformalparameteronlythevalueoftheargumentissubstitutedfortheformalparameter.

C:

Finaltranslation:

TOP

Originalsentence:

Foraninputfunction,youwantthevariable(notthevalueofthevariable)tobesubstitutedfortheformalparameter.

Extracomments:

S+V:

youwant

C:

Q:

E:

youwantthevariable

C:

Q:

E:

youwantthevariabletobesubstituted

C:

Q:

E:

youwantthevariabletobesubstitutedfortheformalparameter.

C:

Q:

E:

youwantthevariable(notthevalueofthevariable)tobesubstitutedfortheformalparameter.

C:

Q:

E:

Foraninputfunction,youwantthevariable(notthevalueofthevariable)tobesubstitutedfortheformalparameter.

C:

Finaltranslation:

TOP

Originalsentence:

Thecall-by-referencemechanismworksinjustthisway.

Extracomments:

S+V:

Themechanismworks

C:

Q:

E:

Thecall-by-referencemechanismworks

C:

Q:

E:

Thecall-by-referencemechanismworksinthisway.

C:

Q:

E:

Thecall-by-referencemechanismworksinjustthisway.

C:

Finaltranslation:

TOP

Originalsentence:

Withacall-by-referenceformalparameter,thecorrespondingargumentinafunctioncallmustbeavariable,andthisargumentvariableissubstitutedfortheformalparameter.

Extracomments:

Clause1:

Withacall-by-referenceformalparameter,thecorrespondingargumentinafunctioncallmustbeavariable,

Clause2:

andthisargumentvariableissubstitutedfortheformalparameter.

Analysis:

Clause1:

Withacall-by-referenceformalparameter,thecorrespondingargumentinafunctioncallmustbeavariable,

S+V:

thecorrespondingargumentmustbe

C:

Q:

E:

thecorrespondingargumentinafunctioncallmustbe

C:

Q:

E:

thecorrespondingargumentinafunctioncallmustbeavariable,

C:

Q:

E:

Withacall-by-referenceformalparameter,thecorrespondingargumentinafunctioncallmustbeavariable,

C:

Clause2:

andthisargumentvariableissubstitutedfortheformalparameter.

S+V:

andthisargumentvariableissubstituted

C:

Q:

E:

andthisargumentvariableissubstitutedfortheformalparameter.

C:

Finaltranslation:

TOP

Originalsentence:

Itisalmostasiftheargumentvariablewereliterallycopiedintothebodyofthefunctiondefinitioninplaceoftheformalparameter.

Extracomments:

Clause1:

Itisalmost(sth=as_if...)

Clause2:

asiftheargumentvariablewereliterallycopiedintothebodyofthefunctiondefinitioninplaceoftheformalparameter.

Analysis:

Clause1:

Itisalmost(sth=as_if...)

S+V:

Itis

C:

Q:

E:

Itis(sth=as_if...)

C:

Q:

E:

Itisalmost(sth=as_if...)

C:

Clause2:

asiftheargumentvariablewereliterallycopiedintothebodyofthefunctiondefinitioninplaceoftheformalparameter.

S+V:

asiftheargumentvariablewerecopied

C:

Q:

E:

asiftheargumentvariablewerecopiedintothebody

C:

Q:

E:

asiftheargumentvariablewerecopiedintothebodyofthefunctiondefinition

C:

Q:

E:

asiftheargumentvariablewerecopiedintothebodyofthefunctiondefinitioninplaceoftheformalparameter.

C:

Q:

E:

asiftheargumentvariablewereliterallycopiedintothebodyofthefunctiondefinitioninplaceoftheformalparameter.

C:

Finaltranslation:

TOP

Originalsentence:

Aftertheargumentissubstitutedin,thecodeinthefunctionbodyisexecutedandcanchangethevalueoftheargumentvariable.

Extracomments:

Clause1:

Aftertheargumentissubstitutedin,

Clause2:

thecodeinthefunctionbodyisexecutedandcanchangethevalueoftheargumentvariable.

Analysis:

Clause1:

Aftertheargumentissubstitutedin,

S+V:

Aftertheargumentissubstituted

C:

Q:

E:

Aftertheargumentissubstitutedin,

C:

Clause2:

thecodeinthefunctionbodyisexecutedandcanchangethevalueoftheargumentvariable.

S+V:

thecodeisexecutedandcanchange

C:

Q:

E:

thecodeinthefunctionbodyisexecutedandcanchange

C:

Q:

E:

thecodeinthefunctionbodyisexecutedandcanchangethevalue

C:

Q:

E:

thecodeinthefunctionbodyisexecutedandcanchangethevalueoftheargumentvariable.

C:

Finaltranslation:

TOP

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 工程科技 > 能源化工

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2