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的更多相关文章

  1. delphi 属性 参数 新注释

    delphi 属性 参数 新注释,在写代码的时候,可以自动看到属性.参数的的备注说明,太方便了. Tmyclass=class /// <summary> /// 姓名 /// </ ...

  2. Java中main方法参数String[ ] args的使用。

    我们刚开始学习java时都会被要求记住主方法(main)的写法,就像这样: public static void main(String[] args){ } public static void m ...

  3. string integer == equals 转

    java中的数据类型,可分为两类: 1.基本数据类型,也称原始数据类型.byte,short,char,int,long,float,double,boolean   他们之间的比较,应用双等号(== ...

  4. CharsRefIntHashMap并不比HashMap&lt;String, Integer&gt;快

    我模仿lucene的BytesRef写了一个CharsRefIntHashMap,实測效果并不如HashMap<String, Integer>.代码例如以下: package com.d ...

  5. main方法中参数"String[ ] args"详解

    1.在编写完一个有主方法的java文件时,需要在cmd窗口中先编译此java文件(javac xxx.java),然后再运行(java xxx) 其实在运行java xxx的时候如果后面跟着参数用空格 ...

  6. String,Integer,int类型之间的相互转换

    String, Integer, int 三种类型之间可以两两进行转换 1. 基本数据类型到包装数据类型的转换 int -> Integer (两种方法) Integer it1 = new I ...

  7. java中的main方法参数String[] args的说明

    参数String[] args 的作用是在运行main方法时,在控制台输入参数 class Test{ public static void main(String[] args){ for(Stri ...

  8. Junit + String/Integer/ArrayList/HashMap/TreeMap 基本使用Demo

    package JavaTest.test; import java.util.ArrayList; import java.util.HashMap; import java.util.List; ...

  9. Delphi程序带参数运行

    程序1 program E1; uses Forms,Dialogs,SysUtils, EndM1 in 'EndM1.pas' {Form2}; {$R *.res} begin Applicat ...

随机推荐

  1. 省身 (zhuan)

    http://blog.csdn.net/marksinoberg/article/details/52419152 ***************************************** ...

  2. VC++多工程项目

    目录 第1章 VC++6.0    1 1.1 设置依赖关系    1 1.2 编译顺序    2 1.3 自动连接    3 1.4 静态库    3 1.4.1 嵌入    3 1.4.2 替换  ...

  3. @font-face字体文件用法

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  4. CentOS 7.x安装配置

    简述 VMware可以创建多个虚拟机,每个虚拟机上都可以安装各种类型的操作系统.安装方法也有很多种.下面,主要以ISO镜像安装为例,介绍CentOS 7.x的安装过程及相关的参数设置. 简述 创建虚拟 ...

  5. (转载)Android理解:显式和隐式Intent

    Intent分两种:显式(Explicit intent)和隐式(Implicit intent). 一.显式(设置Component) 显式,即直接指定需要打开的activity对应的类. 以下多种 ...

  6. System.OutOfMemoryException: 内存不足。(转)

    主要是网站生成水印图片的时候遇到的 原文地址:http://www.cnblogs.com/longgel/archive/2010/03/24/1693776.html 今天调试asp.net 程序 ...

  7. html5的标签

    1.article与section div的区别 当一个标签只是为了样式化或者方便脚本使用时,应该使用 div . section 表示一段专题性的内容,一般会带有标题.,section 应用的典型场 ...

  8. Objective-C:模拟按钮点击事件理解代理模式

    OC中的协议(Protocol)和和.NET中的接口(Interface)类似,简单来讲,就是一系列方法的列表,其中声明的方法可以被任何类实现.不同的是,在.NET中,如果某个类实现了一个接口,就必须 ...

  9. Android中visibility属性VISIBLE、INVISIBLE、GONE的区别

    详情见:http://blog.csdn.net/chindroid/article/details/8000713

  10. 获取图片颜色的rgb,以供css设计背景颜色

    ColorPix