1. 首页
  2. 数据库
  3. 其它
  4. interface源码阅读

interface源码阅读

上传者: 2021-01-16 19:07:26上传 PDF文件 44.83KB 热度 14次
interface interface的实现 所有interface,包括有方法和空接口,在内存中都是占据两个字长。那么在32位机器上就是8个字节,在64位机器上就是16个字节。 空interface的底层实现 在Go语言的源码位置: src\runtime\runtime2.go中 type eface struct { _type *_type //类型指针 data unsafe.Pointer //数据区域指针 } 可以看到对于空的interface,其实就是两个指针。,先看第一个rtype类型, 这个就表示类型基本信息,包括类型的大小,对齐信息,类
下载地址
用户评论