У нас вы можете посмотреть бесплатно In go, is it safe to store pointer of a local variable in global map? [closed] или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
Hello everyone! I hope this video has helped solve your questions and issues. This video is shared because a solution has been found for the question/problem. I create videos for questions that have solutions. If you have any other issues, feel free to reach out to me on Instagram: / ky.emrah Below, you can find the text related to the question/problem. In the video, the question will be presented first, followed by the answers. If the video moves too fast, feel free to pause and review the answers. If you need more detailed information, you can find the necessary sources and links at the bottom of this description. I hope this video has been helpful, and even if it doesn't directly solve your problem, it will guide you to the source of the solution. I'd appreciate it if you like the video and subscribe to my channel!In go, is it safe to store pointer of a local variable in global map? [closed] I know that closure feature guarantees pointer of local variable returned from function can be used safely. But what if the pointer not be returned? For example, just save it in a global map: type bigUnit struct { ... } var globalIndex = map[string]*bigUnit{} func newBigUnit(id int, ...) { newOne := bigUnit{ ... } globalIndex[id] = &newOne } type bigUnit struct { ... } var globalIndex = map[string]*bigUnit{} func newBigUnit(id int, ...) { newOne := bigUnit{ ... } globalIndex[id] = &newOne } Will the newOne be kept until the end of program? newOne Tags: go,closuresSource of the question: https://stackoverflow.com/questions/7... Question and source license information: https://meta.stackexchange.com/help/l... https://stackoverflow.com/