# Type-C - C11 with variants, options, generics and exhaustive matching

Original title: Show HN: Type-C – variants, options, generics and pattern matching for C

> Hacker News story 50602561 · language: en · submitted 2026-11-22
> Web version: https://zeli.app/story/50602561
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 25 · by [stass](<https://news.ycombinator.com/user?id=stass>) · 💬 4
[original](<https://github.com/stass/type-c>) · [HN discussion](<https://news.ycombinator.com/item?id=50602561>)

## Summary

Type-C extends C11 with the types C has always lacked: closed variants, distinct types, generics, and errors as values with try and defer. Its compiler, typec, takes the same command line as cc and translates Type-C into readable C that your existing compiler builds. A C11 file is already a Type-C file, so you can adopt it one file at a time without changing your toolchain, headers, or debugger. The result is safer code with no runtime overhead, catching mistakes like wrong union members and forgotten switch cases at compile time.

## Key quote

> Type-C keeps C's declarations, statements, pointers, preprocessor and headers, and adds only what C has no way to say: closed sums, distinct types, type parameters, errors as values and cleanups.

---

## Cite

- Page: https://zeli.app/story/50602561
- Date: 2026-11-22
- Source: github.com (https://github.com/stass/type-c)
- Hacker News: https://news.ycombinator.com/item?id=50602561

## Other languages

- zh: https://zeli.app/zh/story/50602561 · markdown: https://zeli.app/zh/story/50602561.md
- ja: https://zeli.app/ja/story/50602561 · markdown: https://zeli.app/ja/story/50602561.md
- ko: https://zeli.app/ko/story/50602561 · markdown: https://zeli.app/ko/story/50602561.md
- de: https://zeli.app/de/story/50602561 · markdown: https://zeli.app/de/story/50602561.md
- es: https://zeli.app/es/story/50602561 · markdown: https://zeli.app/es/story/50602561.md
- ru: https://zeli.app/ru/story/50602561 · markdown: https://zeli.app/ru/story/50602561.md
