'l', 'o'}
str := string(bytes)
My understanding is string here is not a function, but a feature of the language (casting).
I am interested in knowing exactly how a slice of bytes is converted into a string, not on a theoretical level, but on a source code line-by-line level.
https://github.com/golang/go/blob/d5c5808534f0ad97333b1fd5fff81998f44986fe/src/runtime/string.go#L81 Would this be the place?
And if so, why is it a function? I thought it wouldn't be a function.
I think I don't understand the difference between stdlib and compiler
The compiler will replace the casting call with this function internally
What did you think it would be if not a function?
I don't really know, that's why I am asking! :D Maybe it could be some machine code idk
any function eventually ends up being machine code :D
Обсуждают сегодня