Golang内置函数的实现在哪里?

huangapple go评论76阅读模式
英文:

Where did golang implementation about builtin function

问题

例如,如果我通过调用print()来打印一个接口,然后它会调用printiface(),我想知道这两个语句之间实际上发生了什么。

英文:

For example, if I'm printing an interface by calling print(), and then, It will call printiface(), I'm wondering what does go actually between these two statements.

答案1

得分: 2

根据我所了解的情况,print调用在编译时会转换为printstringprintiface等等。如果你想查看print代码是如何生成的,你可能会对src/cmd/gc/walk.c中的这段代码感兴趣。

英文:

From what I could gather, print calls turn into printstring, printiface, etc. at compile time. If you want to look at how print code is generated, you could be interested in this code in src/cmd/gc/walk.c.

答案2

得分: 1

printiface()方法主要被ifaceI2T()ifaceI2I()ifaceeq()printinter()调用。你可以在runtime/iface.c中找到更多相关信息。

英文:

That method printiface() is mainly called by ifaceI2T(), ifaceI2I(), ifaceeq(), printinter().
So you can see more in runtime/iface.c

huangapple
  • 本文由 发表于 2014年10月6日 21:21:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/26217147.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定