The in-browser compiler is coming soon. A self-hosted SafeC compiler built to WebAssembly is in progress; until it ships, Run can't execute code here. Everything else works: edit, load Book examples, share a link — and run the program locally with safeguard. Install SafeC
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 itsSUBSET.mdand does not run the ownership and thread-safety checks. Programs can include the C library subsetsstdio.h,stdlib.h,string.h,ctype.h,math.h,stdbool.h,stdint.h,stddef.h,limits.h,time.handassert.h, and the std headersstd/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}.hand the small headers they use. - What scc leaves out: inline
asmand bitfields are rejected; SIMD vector types,_Generic,thread_local, the atomic built-ins, calling-convention keywords,naked,section,interruptandmalloc_deferaren't implemented; a program is one translation unit.spawnruns the thread function to completion at once (there are no threads), and pointers are 4 bytes (wasm32), sosizeofof 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