Safe mode: Difference between revisions

Content added Content deleted
(Created Nim answer.)
m (Text formatting.)
Line 118: Line 118:


=={{header|Nim}}==
=={{header|Nim}}==
Nim doesn’t provide safe mode, but it make a distinction between safe and unsafe features. Safe features are those
Nim doesn’t provide safe mode, but it make a distinction between safe and unsafe features. Safe features are those which cannot corrupt memory integrity while unsafe ones can.
which cannot corrupt memory integrity while unsafe ones can.


There is currently no restrictions for using unsafe features, but a programmer should be aware that they must be
There is currently no restrictions for using unsafe features, but a programmer should be aware that they must be used with care.
used with care.


Here are some unsafe features:
Here are some unsafe features:


* The ones dealing with raw memory and especially those using pointers. Note that Nim makes a
* The ones dealing with raw memory and especially those using pointers. Note that Nim makes a difference between pointers which allow access to raw (untraced) memory and references which allow access to traced memory.
difference between pointers which allow access to raw (untraced) memory and references which allow access to
traced memory.


* Type casting which, contrary to type conversion, is a simple assignment of a new type without any
* Type casting which, contrary to type conversion, is a simple assignment of a new type without any conversion to make the value fully compatible with the new type.
conversion to make the value fully compatible with the new type.


* Using <code>cstring</code> variables as no index checking is performed when accessing an element.
* Using <code>cstring</code> variables as no index checking is performed when accessing an element.