Snowball Docs
SocialsContributeTry out online!Standard Library
  • 👋Welcome to snowball!
  • Overview
    • 🐈Why Snowball
    • ✨Language Features
  • fundamentals
    • 🛠️Getting started
    • 📝Installation
      • ‼️Common install issues
    • 👶Hello world!
  • language reference
    • 🌐Global Scope
    • 🤖Functions
      • 🐣Basic syntax
      • 😵Function Generics
      • ❓External functions
      • 🔧Function Attributes
      • 💢LLVM Functions
      • 🚪Program Entries
    • 🎭Types
      • 🔢Primitive types
      • 🔀Reference types
      • ☝️Pointer types
      • 🔓Mutability
      • ⁉️Type generics
      • 🔖Type aliases
      • 🚯Unknown pointer type (void pointers)
    • 🔄Casting
      • 🔐Mutability casting
      • 🦺Dynamic casting
      • 👨‍🎓Type conversions
    • 🏗️Classes
      • 💼Members
      • 🔒Access qualifiers
      • 🛑Final classes
      • 🍧Abstract classes
    • 🔏Access qualifiers
    • ⚒️Macros
      • ✨Builtin macros
    • 🔫Unsafe snowball
    • 😴Generics
    • 🌳Code Flow
      • ☝️If statements
    • 📦Modules
      • 👉Using Statement
  • snowball cli usage
    • 💻CLI usage and parameters
    • 🧪Testing mode
  • Confy
    • ⚙️Getting Started
    • 🐈Snowball's Schema
  • Reky Package Manager
    • 📦Getting Started
  • coding style
    • 💅The desired standard
Powered by GitBook
On this page
  • Dereference of a raw pointer
  • Calling unsafe functions
  • Pointer arithmetic

Was this helpful?

Edit on GitHub
  1. language reference

Unsafe snowball

"Unsafe Snowball" refers to a variant or mode of the Snowball programming language that allows for more low-level operations and memory access, similar to "unsafe" features in other programming languages like C or C++. In Snowball, "unsafe" code typically bypasses some of the safety checks enforced by the language's standard mode, allowing for more direct control over memory and system resources.

Dereference of a raw pointer

let mut num = 5;
let r1 = &num as *const i32;

unsafe {
    let x = *r1; // only in unsafe blocks!
}

Calling unsafe functions

Snowball typically refer to specific function or method invocations that are marked as "unsafe." These calls are used when a developer needs to perform operations that can potentially lead to undefined behavior, memory safety issues, or other risks. In Snowball, the "unsafe" keyword is often used to indicate such calls.

unsafe func dangerous() { ... }
    
unsafe {
    dangerous(); // ok, if you are cool with it ¯\_(ツ)_/¯
}

dangerous(); // nah, you can't do that here!

Pointer arithmetic

Unsafe Snowball might allow direct pointer arithmetic, enabling manipulation of memory addresses. This can be error-prone and risky if not used carefully.

TODO TODO TODO TODO TODO

PreviousBuiltin macrosNextGenerics

Last updated 1 year ago

Was this helpful?

🔫