Skip to content

Moka-Reads/ZigUnleashed

Repository files navigation

Zig Unleashed

A Comprehensive Guide to Robust and Optimal Programming

In this repository, you will find code samples for each chapter of the book. The book mentions the name of each file, which corresponds to the respective file in this repository.

Chapters


Software Requirements

It is recommended to use a linux operating system as we use Makefile extensively throughout this repository, however, you may use Windows (recommended to use zig cc/c++ as the C/C++ compiler respectively).

Required:

  • zig: v0.11.0
  • rustc: > v1.63
  • clang/gcc: v13.0.0/v11.4.0
  • g++: v11.4.0
  • make: v4.3

For ch09's cross-compilation you will need the following if you would like to target the Raspberry Pi 4:

Dependencies:

$ sudo apt install gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabihf binutils-arm-linux-gnueabihf-dbg qemu-user

Rust target: rustup target add armv7-unknown-linux-gnueabihf


Statistics

File and Line Distribution

File and Line Distribution Plot

Statistics per Chapter

Chapter 1: Introduction

Language Number of Files Total Lines
Zig 1 8
Total 1 8

Chapter 2: The Basics

Language Number of Files Total Lines
Zig 15 328
C 1 16
Rust 1 9
Total 17 353

Chapter 3: Functions

Language Number of Files Total Lines
Zig 13 269
C 2 43
Rust 1 16
C++ 1 22
Total 17 350

Chapter 4: Arrays and Slices

Language Number of Files Total Lines
Zig 25 454
C 3 123
Total 28 577

Chapter 5: Struct, Enums and Unions

Language Number of Files Total Lines
Zig 10 227
C 3 82
C++ 1 31
Total 14 340

Chapter 6: Pointers and Memory Management

Language Number of Files Total Lines
Zig 17 2126
C 9 93
Total 26 2219

Chapter 7: Error Handling

Language Number of Files Total Lines
C++ 1 18
Zig 1 20
Rust 1 21
Total 3 59

Chapter 8: Interfacing with C

Language Number of Files Total Lines
C 4 258
Zig 4 22062
Total 8 22320

Chapter 9: Advance Topics

Language Number of Files Total Lines
Rust 2 6
C 1 6
Zig 3 99
Total 6 111

About

Code samples for Zig Unleashed

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages