Safe mode: Difference between revisions

Added Go
(Added Go)
Line 4:
 
Along with a simple yes/no answer, describe what features are restricted when running in safe mode.
 
=={{header|Go}}==
''Any'' code written in Go is considered to be 'safe' unless it uses one or more of the following features:
 
* The 'unsafe' package.
 
* The 'reflect' package.
 
* cgo.
<br>
Although 'normal' Go code uses pointers, arithmetic on them is not permitted and so they cannot be made to point to arbitrary locations in memory. However, the 'unsafe' package contains features which do allow one to perform pointer arithmetic with all the risks this entails.
 
The 'reflect' package allows one to inspect and manipulate objects of arbitrary types and exposes internal data structures such as string and slice headers. This can result in fragile code where mistakes which would normally be identified at compile time will instead manifest themselves as runtime panics.
 
'cgo' is Go's bridge to using C code. As such it is just as unsafe as writing C code directly.
 
=={{header|Jsish}}==
9,476

edits