zoukankan      html  css  js  c++  java
  • 修饰符(整数篇)

    unit Unit4;
    
    interface
    
    uses
      Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
    
    type
      TForm4 = class(TForm)
        Button1: TButton;
        Memo1: TMemo;
        Button2: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form4: TForm4;
    
    implementation
    
    {$R *.dfm}
    
    procedure integer1(a: Integer);
    begin
      a := a + 1;
    end;
    
    procedure integer2(const a: Integer);
    begin
      //什么都不做
      a.ToString;
    end;
    
    procedure integer3(var a: Integer);
    begin
      a := a + 1;
    end;
    
    procedure integer4(out a: Integer);
    begin
      a := a + 1;
    end;
    
    procedure Int641(a: Int64);
    begin
      a := a + 1;
    end;
    
    procedure Int642(const a: Int64);
    begin
      //什么都不做
      a.ToString;
    end;
    
    procedure Int643(var a: Int64);
    begin
      a := a + 1;
    end;
    
    procedure Int644(out a: Int64);
    begin
      a := a + 1;
    end;
    
    procedure TForm4.Button1Click(Sender: TObject);
    var
      i: Integer;
      i2: Int64;
    begin
      i := 10;
      i2 := 10;
      Integer1(i);
      Memo1.Lines.Add(i.ToString);
    end;
    
    end.

    首先Integer1---无修饰符

     

    =========================================================================

     integer2---const

    =========================================================================

     integer3---var

     

    =========================================================================

     integer4---out

     经过测试 int64也是如此。

    结论:整型 是传值的,就是说 所有的整型要么值复制一份入栈,要么直接用原来的值,与堆无关。

  • 相关阅读:
    ECharts 上传图片Example
    SpringBoot|mybatis-maven依赖
    SpringBoot|web应用开发-CORS跨域资源共享
    IDEA|自动生成序列化ID
    SpringBoot|自定义业务异常使用
    SpringBoot|常用配置介绍
    SpringBoot|多环境配置
    SpringBoot|其他常用注解
    SpringBoot|以jar包形式运行springboot服务
    SpringBoot|restfull风格的接口实现方式
  • 原文地址:https://www.cnblogs.com/del88/p/6389306.html
Copyright © 2011-2022 走看看