Golang Unsafe Type Conversions and Memory Accessby@avk-ai
4,872 reads

Golang Unsafe Type Conversions and Memory Access

March 15th 2020
4 min
by @avk-ai 4,872 reads
tldt arrow
Read on Terminal Reader🖨️

Too Long; Didn't Read

Go is strongly typed, you have to convert variable from one type to another to use in different parts of application. But sometimes you need to step around this type safety. Unsafe operation potentially could safe a lot of allocations. It also allows to hack into any struct field, including slices, strings, maps etc. It's called unsafe for a reason. It could be needed to optimization of bottle necks in high load systems, where every tick counts. Go compiler understands that string is constant and put it in memory along with other constants.

Company Mentioned

Mention Thumbnail
featured image - Golang Unsafe Type Conversions and Memory Access
Aleksandr Kochetkov HackerNoon profile picture

@avk-ai

Aleksandr Kochetkov

About @avk-ai
LEARN MORE ABOUT @AVK-AI'S EXPERTISE AND PLACE ON THE INTERNET.
react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!
Hackernoon hq - po box 2206, edwards, colorado 81632, usa