Why does go’s compiler “GC” use a different calling convention from C?

C uses cdecl, and I've looked at it and called it with an assembly It feels good. Why break compatibility? Why is another convention needed?

Solution

Because having the same calling convention has no advantage Even if the calling convention is the same, go code and C code cannot call each other directly, because go uses split stack

Otoh, which is very meaningful in GCC go, because GCC supports c-split stack of some architectures Moreover, IIRC, the calling convention is compatible (more details here.)

Disclaimer: I have never really used gccgo

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>