lang • unsafe


Since 3.12


The UNSAFE keyword, used with FAST, allows the just-in-time compiler to use unsafe but faster code.

Using that keyword has the following effects:

  • Conversion from Float to Single does not check for overflow.

  • Public object variables are accessed without checking if the object reference is null, or if the object is invalid.

  • Array access does not check for index validity.

  • Division by zero is not checked.

  • Bit access functions do not check the bit index.

  • Mathematical functions result validity is not checked.

  • Memory access functions do not check for illegal memory access.

So incorrect code compiled with the UNSAFE keyword usually leads to interpreter crashes, or indeterminate behaviour at best.

See also