Learn SafeC

New to SafeC? Start with the Book. Coming from C, C++, Rust or Zig? The guide's comparison and design pages explain what changes and why. Looking something up? The reference and the standard-library pages are the source of truth.

Start here

The SafeC Book

A project-driven introduction in nine chapters: installing, a first program, regions, structs and methods, enums and match, error handling and a final project.

Guide

What SafeC is and isn't: the introduction, getting started, the design philosophy and a comparison with C, C++, Rust and Zig.

Playground

Edit and run SafeC in the browser and load every runnable example from the Book. Programs on this site that the playground can build have a Run in Playground link.

Reference

Language Reference

Types, operators, literals, memory and regions, functions, generics, polymorphism, safety, C interop, concurrency, bare metal and the preprocessor.

Standard Library

Every std module with its API: core, collections, serialization, async, networking, HTTP and TLS, GUI, audio, WebAssembly, ML, crypto, embedded.

API Reference

Every std declaration, generated from the sources by safeguard doc --std: per-item pages with signatures, doc comments and source links, a module tree and search. Your own libraries get the same with safeguard doc.

Examples

Examples on GitHub

Complete projects in the SafeC repository: async_demo, audio_demo, fullstack_demo (a router server and a wasm client), gui_hello, gui_gallery, gui_web (a GUI program as a web page), doc_demo (a library documented with safeguard doc), and C++ / Objective-C dependencies.

Benchmarks

SafeC against C, C++, Rust, Zig and Go — compute kernels, allocation, collections, a web service, ML training — with the source of every program.

This website

A real program: the site you are reading is generated by SafeC — std markdown, scx templates and a SafeC-to-WebAssembly client.

Tools and news