当前位置: 首页 > news >正文

06627网页制作与网站建设中企动力营销平台

06627网页制作与网站建设,中企动力营销平台,php 禁止电脑访问网站,中国四川机械加工网定义说明 静态类型(static type):在编码时就能确定的类型,通过变量定义可以确定的类型;动态类型(concrete type):在运行时才能确定具体的数据类型; 动态静态类型如何理…

定义说明

  • 静态类型(static type):在编码时就能确定的类型,通过变量定义可以确定的类型;
  • 动态类型(concrete type):在运行时才能确定具体的数据类型;

动态静态类型如何理解?

go 语言中interface(any)可以承接所有类型的数据,所以这部分只有具体运行的时候,才能确定数据具体类型:

	var i interface{}var num int = 1var str string = "hello world"i = numi= str

在该示例中,第一行声明了一个interface的变量i,在编码时就可以确定了,所以i的静态类型就是interface;
同理,第二行num的静态类型为int,第三行str的静态类型为string
第四行,把num赋值给inum的实际类型是int, 所以此时,i的动态类型就是int
第五行,把str赋值给inum的实际类型是string,所以此时,i的动态类型就是string

Golang 中的interface的底层延申:

golang 中interface有两种含义/用法:

  1. 常规的接口类型,有一些带实现的接口定义
  2. 表示任意数据类型any

golang 的底层实现也是根据这两种情况做了不同的实现,底层分别对应ifaceeface

// 空接口结构
type eface struct {_type *_type			// 实体类型data  unsafe.Pointer	// 数据地址
}// 包含方法的结构
type iface struct {tab  *itab			// 接口和实体类型data unsafe.Pointer	// 数据地址
}type itab struct {inter *interfacetype_type *_typehash  uint32 // copy of _type.hash. Used for type switches._     [4]bytefun   [1]uintptr // variable sized. fun[0]==0 means _type does not implement inter.
}type interfacetype struct {typ     _typepkgpath namemhdr    []imethod
}type imethod struct {name nameOffityp typeOff
}type _type struct {size       uintptrptrdata    uintptr // size of memory prefix holding all pointershash       uint32tflag      tflagalign      uint8fieldAlign uint8kind       uint8// function for comparing objects of this type// (ptr to object A, ptr to object B) -> ==?equal func(unsafe.Pointer, unsafe.Pointer) bool// gcdata stores the GC type data for the garbage collector.// If the KindGCProg bit is set in kind, gcdata is a GC program.// Otherwise it is a ptrmask bitmap. See mbitmap.go for details.gcdata    *bytestr       nameOffptrToThis typeOff
}type nameOff int32
type typeOff int32
type tflag uint8
http://www.yayakq.cn/news/525173/

相关文章:

  • 校园网站管理系统太和网站建设
  • 广州外贸营销型网站建设公司企业vi设计的基本要素
  • 肥西网站建设星大建设集团招聘网站
  • 网站建设高端品牌只做网站的人员工资
  • 北京电子商务网站制作天津河北做网站的公司排名
  • .net 网站生成安装文件目录商家做小程序怎么做
  • django 做网站赚钱做微信公众号还是网站
  • 易语言怎么做无限打开网站网站被谷歌收录
  • 开发做网站公司郑州租赁房网站建设
  • 许昌做网站公司手机wap网站大全
  • 盐城专业做网站方案策划
  • wordpress站内链接湖北网站建设软件有哪些
  • 四川遂宁做网站的公司如何建立一个自己的网站啊
  • 营销型企业网站分重庆做网站建设的公司哪家好
  • 集团官网及站群网站建设网上商城网站建设设计方案
  • 网站制作的一般步骤杭州哪家做外贸网站
  • 衡阳百度网站建设个人网站免费域名获取
  • 章贡区建设局网站一流高职院校建设计划项目网站
  • 请问做网站需要什么建设网站的情况说明书
  • 什么站做咨询网站好常州哪些网站公司做的好处
  • 网站建设与规划结课论文短网址服务平台
  • aspx怎么做网站怎样做一个自己的小程序
  • wordpress免费企业主题网站wordpress 占用内存
  • 网站优化排名哪家好提升学历的学校
  • 怎么做网站关键字搜索上海市工程建设咨询监理有限公司
  • 网站建设+开源辛集哪做网站
  • 易企秀 旗下 网站建设找人搭建网站多少钱
  • 采集数据做网站广州开发公司
  • 随州网站建设哪家优惠seo网站诊断方案
  • 上海专业建网站长沙网站seo报价