module hello_world;
import std::io;
fn void main()
{
io::printn("Hello, world!");
}
module hello_world;
import std::io;
fn void main()
{
io::printn("Hello, world!");
}
C3 fits right into your C/C++ application with full C ABI compatibility out of the box: no need for special "C compatible" types or functions, no limitations on what C3 features you can use from C.
A simple and straightforward module system that doesn't get into the way with defaults that makes sense.
Macros that are just as easy to read and write as regular functions. Packing much more power than C's preprocessor, they're deliberately balanced to ensure that code reading isn't made difficult.
C3 is a programming language that builds on the syntax and semantics of
the C language, with the goal of evolving it while still retaining
familiarity for C programmers.
Thanks to full ABI compatibility with C, it's possible to mix C and C3 in
the same project with no effort. As a demonstration, vkQuake was compiled
with a small portion of the code converted to C3 and compiled with the c3c
compiler.
C3 brings programming-by-contract to the mainstream with unobtrusive contracts that are used to express both runtime and compile-time constraints.
Error handling that combines the best parts of "Result" errors with the easy use of exceptions and integrates seamlessly with C.
Slices are type safe "pointer + length" types which natively supports copying and comparison.
C3 generic modules offer superior simplicity and clarity for creating generic types.
Type introspection is available both at compile time and runtime, powering flexible macros and functions
Write asm as regular inline code without using strings or cryptic constraints.
Feel confident in your code's correctness: in debug mode the compiler inserts extensive runtime bounds checks and value checks, which together with contracts will let you catch bugs early.
No more anonymous "segmentation fault" errors: the C3 standard library enables detailed stacktraces out of the box for your debug builds.