Delphi out 参数 string Integer
http://www.delphibasics.co.uk/RTL.asp?Name=Out
http://stackoverflow.com/questions/14507310/whats-the-difference-between-var-and-out-parameters
A var parameter will be passed by reference, and that's it.
var参数将以引用方式传递。
An out parameter is also passed by reference, but it's assumed that the input value is irrelevant.
out参数也是以引用传递,但是它(编译器)假定输入值是不相关的。
For managed types, (strings, Interfaces, etc,) the compiler will enforce this, by clearing the variable before the routine begins, equivalent to writing param := nil.
对(生存期自动)管理的类型(字符串,接口,等),编译器会强制在routine开始前清空out变量,等同于写参数值为空。
For unmanaged types, the compiler implements out identically to var.
对非管理类型,编译器实现out等同于var参数。
Note that the clearing of a managed parameter is performed at the call-site and so the code generated for the function does not vary with out or var parameters.
说明,对受管理类型参数的清理是在 调用位置 进行的,所以(编译器)为被调用函数产生的代码是不包括out或var参数的。
share|edit
edited Jan 24 '13 at 19:05
David Heffernan
316k22396683
answered Jan 24 '13 at 17:38
Mason Wheeler
procedure testout(const str: string; out a: string; out I: Integer);
begin
ShowMessage(a + IntToStr(I));//100 a是空的
a := str;
I := 200;
end; procedure TForm1.Button1Click(Sender: TObject);
var
s, ss, ds, qx, dz: string;
I: Integer;
jo: ISuperObject;
begin
s := '外面';
ss:= 'out';
I:= 100;
testout(s, ss, I);
ShowMessage(ss + IntToStr(I));//外面200 Exit; end;
Delphi out 参数 string Integer的更多相关文章
- delphi 属性 参数 新注释
delphi 属性 参数 新注释,在写代码的时候,可以自动看到属性.参数的的备注说明,太方便了. Tmyclass=class /// <summary> /// 姓名 /// </ ...
- Java中main方法参数String[ ] args的使用。
我们刚开始学习java时都会被要求记住主方法(main)的写法,就像这样: public static void main(String[] args){ } public static void m ...
- string integer == equals 转
java中的数据类型,可分为两类: 1.基本数据类型,也称原始数据类型.byte,short,char,int,long,float,double,boolean 他们之间的比较,应用双等号(== ...
- CharsRefIntHashMap并不比HashMap<String, Integer>快
我模仿lucene的BytesRef写了一个CharsRefIntHashMap,实測效果并不如HashMap<String, Integer>.代码例如以下: package com.d ...
- main方法中参数"String[ ] args"详解
1.在编写完一个有主方法的java文件时,需要在cmd窗口中先编译此java文件(javac xxx.java),然后再运行(java xxx) 其实在运行java xxx的时候如果后面跟着参数用空格 ...
- String,Integer,int类型之间的相互转换
String, Integer, int 三种类型之间可以两两进行转换 1. 基本数据类型到包装数据类型的转换 int -> Integer (两种方法) Integer it1 = new I ...
- java中的main方法参数String[] args的说明
参数String[] args 的作用是在运行main方法时,在控制台输入参数 class Test{ public static void main(String[] args){ for(Stri ...
- Junit + String/Integer/ArrayList/HashMap/TreeMap 基本使用Demo
package JavaTest.test; import java.util.ArrayList; import java.util.HashMap; import java.util.List; ...
- Delphi程序带参数运行
程序1 program E1; uses Forms,Dialogs,SysUtils, EndM1 in 'EndM1.pas' {Form2}; {$R *.res} begin Applicat ...
随机推荐
- iOS开发之 Xcode 5 下让你的应用在不同状态(debug, release)有不同的图标
http://nickcheng.com/post/unique-icons-for-your-app-in-different-state-in-xcode5-debug-release 应用在发布 ...
- OpenGL的gluPerspective和gluLookAt的关系[转]
函数原型void gluLookAt(GLdoble eyex, GLdouble eyey, GLdouble eyez, GLdouble centerx, GLdouble centery, ...
- PhoneGap插件开发流程
前几天写了一个PhoneGap插件,这个插件的功能很简单,就是开启viewport设置.不过与其它插件相比,有好几个有意思的地方,仔细读了PhoneGap的源码才搞定.这里记录一下PhoneGap插件 ...
- Eclipse中Ant的配置与测试 转
欢迎关注我的社交账号: 博客园地址: http://www.cnblogs.com/jiangxinnju/p/4781259.html GitHub地址: https://github.com/ji ...
- bfs 胜利大逃亡
http://acm.hdu.edu.cn/showproblem.php?pid=1253 题目: Ignatius被魔王抓走了,有一天魔王出差去了,这可是Ignatius逃亡的好机会. 魔王住在一 ...
- [saiku] olap数据源管理
一.应用场景 系统初始化的时候 如果没有创建olap数据源需要先创建olap数据源 否则直接获取所有的数据源存放在全局变量datasources里面以便于后续步骤中获取plap-connections ...
- ubuntu环境变量添加变量
1.sudo gedit /etc/profile打开环境变量文件夹 2.在文件末尾另起一行输入要加入的环境变量 格式: export XXXXXX=XXXXXX 3.重启 OK
- Junit4入门
eclipse自带junit包,可右键直接新建junit类 静态引入:import static org.junit.Assert.* assert.*是类,静态引入会引入assert里的所有静态方法 ...
- Linux下把Mysql和Apache加入到系统服务里
Linux下注册Apache与MySQL为系统服务 Apache加入到系统服务里面: cp /安装目录下/apache/bin/apachectl /etc/rc.d/init.d/httpd 修改h ...
- hdu 1811 Rank of Tetris (并查集+拓扑排序)
Rank of Tetris Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)To ...