All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
ASP.NET通过IE直接打印_[Asp.Net教程]
SQL循序渐进(7)更新记录_[SQL,Server教程]
用PHP生成自己的LOG文件_[PHP教程]
在c#中Windows窗体概述
C#教程:单线程简介
PHP入门需要掌握的几种功能代码_[PHP教程]
Apache重写规则的常见应用及实例说明_php资料_编程技术
VS.Net,C#,调用,Active,组件_[Asp.Net教程]
PHP-Nuke存在远程SQL注入漏洞,后台数据库堪忧_php资料_编程技术
用PHP5的DirectoryIterators递归扫描目录_[PHP教程]
Reading number is top 10 pictures
2015中美最新武器装备巅峰对决!
上传几张色图
俞敏洪在清华终于说了实话
The real super beauty2
A man's favorite things1
Household design classic black and white
恶搞漫画2
开始让人感动,后来......
Summer is most suitable for young people to travel in China7
Photographed the passion of the clients and prostitutes in the sex trade picture1
Download software ranking
The hero
终极变速大师Speeder3.26
The Bermuda triangle1
Boxer vs Yellow4
美女写真3
Tram sex maniac 2 (H) rar bag5
Take off clothes to survival
matrix1
jdk1.6 for windows
1400篇各类破解文章
aaa published in(发表于) 2014/7/19 0:13:36 Edit(编辑)
Delphi过程与函数的调用约定

Delphi过程与函数的调用约定

Delphi过程与函数的调用约定

过程与函数的调用约定

在调用过程或函数的时候,如果参数列表中具有多个参数,那么参数传递给过程或函数的顺序会对结果产生一定的影响。对于不同的语言,参数传递的顺序是不同的:Pascal 语言是按照从左向右的顺序进行传递的,而C 语言是按照从右向左的顺序来传递的。为了确定传递的顺序,可以在过程或函数定义的时候,在Directives 部分利用指令字指定传递的顺序。

来自Delphi 的联机帮助的数据,如表4-13 所示,其中列举了Directives 部分可使用的关于函数调用约定的指令字。

定义过程与函数时对调用约定起作用的指令字

·Register:从左向右

·Pascal:从左向右

·Stdcall:从右向左

·safecall:从右向左

·Cdecl:从右向左

可以通过下面的例子查看参数传递的顺序:

program Project1;

{$APPTYPE CONSOLE}

function P1:Integer; //该函数将作为GetMax 函数的第1 个参数

begin

Writeln(’P1’);

Result:=0;

end;

function P2:Integer; //该函数将作为GetMax 函数的第2 个参数

begin

Writeln(’P2 ’) ;

Result:=1;

end;

//参数的传递方式采用pascal 方式

function GetMax(N1:Integer; N2:Integer):Integer;pascal;

begin

Result:=N1+N2;

end;

begin

GetMax(P1,P2);

end.

运行结果如下:

P1

P2

如果将GetMax 函数定义处的Directives 部分由Pascal 改为Stdcall,则运行结果变为:

P2

P1

用户可以修改GetMax 函数定义处的Directives 部分为表4-9 中的其他数值,测试结果是否一致。




添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.