/
githubmirror
/
go
Обзор
Документация
Войти
/
githubmirror
/
go
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/unsafe_string.go
18 строк
367 B
cuiweixie
cmd/compile: add support for unsafe.{String,StringData,SliceData}
31 авг 2022, 20:15
31 авг 2022, 20:15
c708532
Код
Авторство
О чём код?
// run // Copyright 2022 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "unsafe" ) func main() { hello := [5]byte{'m', 'o', 's', 'h', 'i'} if unsafe.String(&hello[0], uint64(len(hello))) != "moshi" { panic("unsafe.String convert error") } }