C+- is a subset of C++ that enables smaller binaries and reduces dependencies
- Custom/slimmed down std lib with essentials (
slimstd
) - malloc provided
new
/new[]
/delete
/delete[]
- Smaller binaries vs normal c++ compiled programs
- Programs only linked against libc(if not statically compiled)
- Classes
- Constructors/destructors & RAII
- virtual functions
- Iterators
- Templates (with support of reflection, see
type_traits.h
)
- RTTI; Cannot
dynamic_cast
or calltypeid()
- Exceptions; need to perform alternative error strategies
- C++ normal stdlib; need to reimplement common data structures
- build example with:
zig build
- run example with:
zig build run
- build release with:
zig build -Drelease-fast=true
orzig build -Drelease-small=true
- cross compile/retarget with:
- default but with gnu linkage:
zig build -Dtarget=native-native-gnu
- default but with musl:
zig build -Dtarget=native-native-musl
- full triple:
zig build -Dtarget=x86_64-linux-musl
- default but with gnu linkage:
Zig tip - print out available targets with zig targets
(WARNING: Large output)