Ctrl/⌘ + Enter runs · Tab indents (Esc, then Tab, moves focus out) · Share puts the program in the URL

    About the playground

    • Examples loads any runnable program from the Book; every SafeC program elsewhere on this site that the playground can build (one that includes only the C and std headers bundled with its compiler, below) has a Run in Playground link that opens it here.
    • Share puts the program into the page's address (#code=…, base64url) and copies the link — nothing is uploaded anywhere.
    • Run compiles and runs the program entirely in your browser, in a background worker, with a self-hosted SafeC compiler built to WebAssembly. Programs see a printf/stdout but no files, network or threads. The compiler is scc, SafeC's compiler written in SafeC (selfhost/); it accepts the language subset described in its SUBSET.md and does not run the ownership and thread-safety checks. Programs can include the C library subsets stdio.h, stdlib.h, string.h, ctype.h, math.h, stdbool.h, stdint.h, stddef.h, limits.h, time.h and assert.h, and the std headers std/io.h, std/str.h, std/mem.h, std/fmt.h, std/math.h, std/convert.h, std/panic.h, std/result.h, std/cmp.h, std/traits.h, std/bit.h, std/atomic.h, std/sys.h, std/time.h (UTC only: there is no time zone, and the clock reads the epoch), std/collections/{slice,vec,string,map}.h and the small headers they use.
    • What scc leaves out: inline asm and bitfields are rejected; SIMD vector types, _Generic, thread_local, the atomic built-ins, calling-convention keywords, naked, section, interrupt and malloc_defer aren't implemented; a program is one translation unit. spawn runs the thread function to completion at once (there are no threads), and pointers are 4 bytes (wasm32), so sizeof of a type holding pointers differs from a 64-bit native build.

    For the checks scc skips, and for the full std, run programs locally:

    bash
    safeguard new hello && cd hello
    # paste the program into src/main.sc
    safeguard run