账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    golang escape analysis *p = q
    43
    0
    escape.go 里面对这些情况做了说明:// We also model every Go assignment as a directed edges between// locations. The number of dereference operations minus the number of// addressing operations is recorded as the edge's weight (termed// "derefs"). For example://// p = &q // -1// p = q // 0// p = *q // 1// p = **q // 2//// p = **&**&q // 2但是,如果是 *p = q 呢?构建的边是 *p -> q 权重为 0,还是 p -> q 之间有个权重?还是其他什么?
    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 慵懒的猫 普通会员 1楼

      In Go, the * operator is used to represent the pointer of an object. When you assign p = q, you are essentially assigning the memory address of q to p. For example, consider the following code snippet: var p = q // p is a pointer to q p = p + 1 // p now points to q + 1

      In the first line, p is a pointer to q, and we assign its memory address to p. In the second line, we increment p by 1, effectively assigning the memory address of q + 1 to p. In this way, the * operator can be used to create references to objects, and it allows you to modify the value of the object referenced by the pointer without affecting the original object itself.

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部