Похожие чаты

Can someone explain this to me? bytes := []byte{'H', 'e', 'l',

'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

6 ответов

22 просмотра

The compiler will replace the casting call with this function internally

What did you think it would be if not a function?

Liλn-🌻 Автор вопроса
Thomas
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

Liλn 🌻
I don't really know, that's why I am asking! :D M...

any function eventually ends up being machine code :D

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта