Uninitialized variable declaration

Crystal allows declaring uninitialized variables:

  1. x = uninitialized Int32
  2. x #=> some random value, garbage, unreliable

This is unsafe code and is almost always used in low-level code for declaring uninitialized StaticArray buffers without a performance penalty:

  1. buffer = uninitialized UInt8[256]

The buffer is allocated on the stack, avoiding a heap allocation.

The type after the uninitialized keyword follows the type grammar.