The C programming language has been around for a long time and is still used a lot nowadays. The core of the language is very solid, but other aspects are showing their age. C2 attempts to modernize these parts, while keeping the feel of C. It should be seen as an evolution of C."
Advantages over C:
higher development speed
much faster compilation
better diagnostics
integrated build system
better support tooling (like Refactor tools, Dependency visualizer)
Changes from C
no header files (instead modules and imports, allowing namespace control)
no forward declarations, just declare once
uniform type declaration syntax
standardized attribute semantics + syntax
compiler-internal build system
-
-
Implementation
C2 uses very few parts of Clang and uses LLVM as code generation backend. Additionally it can also C code directly. It currently parses + analyses around 800.000 lines of code / sec on a single core.
module test; import stdlib; type Type struct { int32 member; } func Type* type_create() { Type* t = stdlib.malloc(sizeof(Type)); t.member = 0; return t; } func void type_init(Type* t) { t.member = 0; } func void type_delete(Type* t) { stdlib.free(t); } func void myfunc() { Type* t = Type.create(); t.init(); t.delete(); }