# C3

C3 is a systems language in the C tradition, designed and led by Christoffer Lerno. Self-described as a "C alternative" rather than a C++/Rust competitor — keeps C's manual memory model and ABI compatibility, but makes opinionated changes to defaults that C's standardization process never could. Compiles via LLVM, links with C, can include C headers directly.

## What's distinctive

The reason C3 ends up in this wiki isn't the syntax — it's the willingness to revisit C's defaults publicly when they don't hold up. The [[unsigned-sizes-c3-mistake|"unsigned sizes was a five year mistake"]] post is an example of the language's design conversations being conducted in writing, with admission of error.

Specific design decisions worth knowing:

- **Modules and slices** baked in, no preprocessor in the C sense.
- **Macros** are a separate hygienic system (`@` prefix), not text substitution.
- **Optionals and errors** unified — return values can carry "fault" types, the `?` and `!` operators handle the propagation.
- **Defer**, like Go and Zig.
- **Contracts** — function-level pre/postcondition annotations.
- **Compile-time evaluation** via `$` prefix — comptime in [[zig]] terms, but separated lexically from runtime code.

## The signed-sizes change

After 5 years on unsigned-default sizes, C3 0.8.0 (2026) flipped the default. The post-mortem ([[unsigned-sizes-c3-mistake]]) argues the original convention — inherited from C's `size_t` — is the root cause of the well-known unsigned bug class, and that ergonomic patches don't reach it. Java and Go are cited as the languages that got this right.

The signed-size type was renamed `isz` → `sz`, with `usz` as the explicit-unsigned counterpart. Implicit signed↔unsigned conversion and mixed comparisons were dropped.

## Blog

The C3 blog at [c3-lang.org/blog](https://c3-lang.org/blog/) is Lerno's writing surface for design rationale, retrospectives, and release notes. Unlike most language blogs, it's willing to publish "this default was wrong" posts.

## Ingested articles

- [[unsigned-sizes-c3-mistake]] — May 2026 post on switching to signed sizes by default

## See also

- [[zig]] — the other "let's redo C" project; differs on unsigned sizes (Zig kept them) and on metaprogramming model
- [[signed-vs-unsigned-sizes]] — the concept this language is currently the canonical worked example of
- [[type-systems-vocabulary]] — adjacent debate space about how language designers talk about types

External: [c3-lang.org](https://c3-lang.org/), [github.com/c3lang/c3c](https://github.com/c3lang/c3c)
