Golang的内置函数实现

zaR*_*Roc 5 go

我无法找到内置函数的实现。

在builtin.go中,这是我发现的:

// The copy built-in function copies elements from a source slice 
into a
// destination slice. (As a special case, it also will copy bytes 
from a
// string to a slice of bytes.) The source and destination may 
overlap. Copy
// returns the number of elements copied, which will be the minimum 
of
// len(src) and len(dst).
func copy(dst, src []Type) int
Run Code Online (Sandbox Code Playgroud)

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

Cer*_*món 2

内置包仅用作文档该包不包含函数的实现。

内置函数是通过编译器和运行时包内部函数的组合来实现的。

您可以在运行时源目录中的 memmove* 文件中找到 copy 的低级实现 。