# C3: A Modern Compiler for Familiar C Semantics with Safer Defaults

> C3 is a general-purpose compiled language that evolves C without replacing it, keeping C syntax and ABI compatibility while adding modules, generics, slices, defer, and result-based error handling, targeting native software development on the platforms where C already runs.

**c3lang/c3c** — Compiler for the C3 language

- Repository: https://github.com/c3lang/c3c
- Website: https://c3-lang.org
- Stars: 5,841 · Forks: 403
- Language: C3
- License: MIT
- Published: 2026-09-22 · Updated: 2026-09-22 · Language: en
- Canonical page: https://hysenlabs.com/projects/c3lang-c3c

## What C3 Is and Who It Is For

C3 is a general-purpose programming language targeting the same problem space as C: applications, games, tools, servers, libraries and systems software. The design goals listed in the README are explicit about scope: procedural, close to C, C ABI compatible, and easy for a C programmer to learn. It does not aim to replace C entirely or introduce a new programming model; it aims to make C-style development safer and more ergonomic.

The primary audience is C developers who find C's lack of generics, the absence of a module system, and the unpredictable behavior of undefined behavior frustrating, but who are not ready to adopt the ownership model of Rust or the different paradigm of Go. The README is direct about the philosophy: "Try to stay close to C - only change what's really necessary."

The language owes its conceptual origin to C2, described in the README as an attempt to iterate on C without inventing an entirely new language.

## Key Differences from C: What C3 Adds

The README lists the concrete differences from C. There are no mandatory header files. The macro system is semantic rather than textual, which means macros participate in type checking and scoping instead of operating as a token-level preprocessor. Namespacing is module-based, replacing the convention of long prefixed symbol names.

Slices give arrays a length and pointer together, which eliminates a common class of bounds errors. Operator overloading is supported. Compile-time reflection and enhanced compile-time code execution are available. Generics are implemented as generic modules, where a parameterized module is instantiated per type set.

Error handling uses a result-based zero-overhead model with defer for cleanup, rather than C's convention of returning error codes and checking them manually. The README notes "Less undefined behaviour and added runtime checks in 'safe' mode," indicating a debug-friendly build mode that adds checks removed in release builds. Value methods allow calling functions on types with dot syntax, so `Stack.push(&my_stack, x)` and `my_stack.push(x)` are equivalent.

## Downloading and Installing c3c

Precompiled binaries are the recommended starting point. The README links to archives for each platform at the latest GitHub release:

- Windows x64: c3-windows.zip
- Linux x64: c3-linux-static.tar.gz
- macOS Arm64: c3-macos.zip
- OpenBSD x64: c3-openbsd.tar.gz

Unpack the archive and the compiler is ready to use. No additional runtime dependencies are required since the binaries are statically linked on Linux.

For building from source, the README lists the required tools: Rust, NodeJS (used during the build process), a GCC or Clang C compiler, Make and Git. The top-level repository entries include a CMakeLists.txt, CMakePresets.json, a Nix flake (flake.nix) for Nix users, and a `build-with-docker.sh` script for containerized builds. The build instructions link to a dedicated section of the README titled "building C3 from source" which is referenced from the download section.

After a successful build, the language manual is at c3-lang.org and an interactive browser-based playground is at learn-c3.org for trying the language without a local install.

## Generics in C3: Generic Modules by Example

The README demonstrates generics through a typed stack implementation. The module keyword parameterizes the entire module with a type:

```c3
module stack <Type>;

struct Stack
{
    sz capacity;
    sz size;
    Type* elems;
}

fn void Stack.push(Stack* this, Type element)
{
    if (this.capacity == this.size)
    {
        this.capacity *= 2;
        if (this.capacity < 16) this.capacity = 16;
        this.elems = realloc(this.elems, Type.sizeof * this.capacity);
    }
    this.elems[this.size++] = element;
}
```

Using the module creates concrete types:

```c3
import stack;

alias IntStack = Stack {int};
alias DoubleStack = Stack {double};
```

The README notes that a second instantiation of `Stack {int}` creates no additional copy; the compiler reuses the first. This is the generic module model: parameterization happens at the module level, not the individual type level, and the compiler handles deduplication.

## Platform Support and What Is Not Yet Verified

The README includes a detailed support matrix for platforms and features including stack traces, threads, sockets and inline assembly. Native C3 compiler availability is confirmed for Win32 x64 and Aarch64, macOS x64 and Aarch64, and Linux x86, x64, Aarch64, Riscv32 and Riscv64. OpenBSD x64 has a native compiler available. FreeBSD x64 is listed as a target without a native compiler.

Several platforms are listed as "Untested": iOS Aarch64, Android Aarch64 and x64, and ELF freestanding targets. This means the compiler can target these architectures in cross-compilation mode, but the standard library support and runtime behavior have not been systematically verified.

The matrix is honest about the gaps. Teams targeting iOS or Android should treat C3 as experimental on those platforms until the status changes.

## C3 Versus Zig: Different Approaches to Evolving C

Zig is the most direct comparison for C3's intended audience. Both languages interoperate with C without a foreign function interface layer, both aim to replace C for new native software, and both improve on C's error handling and undefined behavior story. The difference in approach is that Zig introduces a substantially different syntax and a new build system, while C3 keeps C-like syntax deliberately. The README states the goal is that "Learning C3 should be easy for a C programmer," which implies a shallower migration path.

Zig's comptime feature and its approach to generics differ from C3's generic module system. Neither language is at a 1.0 stability milestone at this writing; both are pre-production for general use in long-lived projects.

C3 also differs from Rust in that it has no ownership model and no borrow checker. The tradeoff is that C3 does not prevent memory safety issues at compile time the way Rust does; its safer-by-default mode adds runtime checks rather than eliminating the class of error at the type level.

## Current Status, Licence and Community

The stable version is 0.8.4, released on 2026-09-11. The last push to the repository was on 2026-09-26, and pre-release builds are published nightly from the develop branch. The README notes the upcoming release will "further refine the standard library and fix bugs," indicating the standard library is still under construction.

The compiler is MIT-licensed. Source is at github.com/c3lang/c3c. The language manual is at c3-lang.org and an interactive browser-based playground is at learn-c3.org. Community discussion runs through Discord at discord.gg/qN76R87. A list of user-written projects is maintained at github.com/c3lang/c3-showcase, providing real-world examples of what the language can do today.

## Conclusion

C3 suits developers who work in C today and want safer defaults, generics and proper modules without the learning curve of Rust or Zig. The full C ABI compatibility means mixing C and C3 in the same project is straightforward, which is a genuine adoption advantage. The language is at version 0.8.4 and pre-1.0, so the standard library and language surface may still change between releases. Before committing to C3 for a production project, verify the completeness of the standard library against your use case at c3-lang.org and confirm your target platform appears in the support matrix in the README.

## FAQ

### What is the C3 language?

C3 is a general-purpose compiled programming language designed as an evolution of C. It keeps C syntax and full C ABI compatibility while adding modules, generics, slices, result-based error handling, defer and value methods. It targets applications, games, tools, servers and systems software on the same platforms where C runs.

### Is there a C3 language?

Yes. C3 is an active open-source language with a compiler called c3c. The stable version is 0.8.4. Prebuilt binaries exist for Windows, Linux, macOS and OpenBSD. The language manual is at c3-lang.org and an interactive playground is at learn-c3.org.

### What is C3 code?

C3 code uses C-like syntax with modules, generics and result-based error handling added. Files use the .c3 extension. The language compiles to native code with the c3c compiler and can call C functions directly thanks to full C ABI compatibility.

## Sources

- [c3lang/c3c on GitHub](https://github.com/c3lang/c3c)
- [License: MIT](https://github.com/c3lang/c3c/blob/master/LICENSE)
- [Project website](https://c3-lang.org)
- [README](https://github.com/c3lang/c3c/blob/master/README.md)
- [Releases](https://github.com/c3lang/c3c/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/c3lang-c3c
