c project
description
Memory management and pointer management library in C
- cross-platfrom C library designed to create a safe C codebase.
- implementation of memory management/type system/GC in C
features
- memory managemens
- GC
- type system
- pointer-free ABI
dashboards
- codacy codacy
status
static analysis
history
- 2025-09-10: added support for codacy; added codacy tokens
- 2025-05-01: added support for MSVC
- 2025-02-28: added mocks for standart functions calloc/free to simulate out-ouf-memory function call flow
examples
u64 data_ptr = 0;
u64 ui_mode_ptr = CALL(string)->load(cvm, "UI_MODE");
u64 mode_ptr = CALL(string)->load(cvm, "--ui");
u64 value_ptr = CALL(env)->getenv(cvm, ui_mode_ptr);
if (ui_mode_ptr != 0 && CALL(string)->strcmp(cvm, value_ptr, mode_ptr) != 0) {
data_ptr = read_input(prompt);
} else {
printf(">%s:\n", prompt);
data_ptr = CALL(list)->pop(list_ptr);
if (data_ptr == 0) {
printf("\n");
}
}
return data_ptr;
}
const_vm_ptr cvm = CALL(vm)->init(8); // initializes virtual memory manager with chunk size of 8
// some work with standard classes: os, string, data, etc.
CALL(vm)->gc(); // releases all resources added to GC
CALL(vm)->destroy(); // releases virtual memory manager
return 0;
}
commands
./bin/init.sh --clangd
./bin/init.sh --init --setup
./bin/init.sh --env
./bin/coverageall.sh --all --clean
./bin/target.sh --target=main-tests-vm1 --release
./bin/cmake.sh --target=main-tests-vm1 --verbose --tty
./bin/lib.sh --c-sys
./bin/lib.sh --c-vm
build commands
./bin/cmake.sh --target=main-tests-vm1 --verbose --tty --clean
./bin/cmake.sh --target=main-tests-vm1 --verbose --tty --clean --release
./bin/cmake.sh --target=main-tests-vm1 --verbose --tty --clean --gc
./bin/cmake.sh --target=main-tests-vm1 --verbose --tty --clean --gc --release
./bin/coverageall.sh --all --clean
resources
youtube
vision
- managed (C programming language model)
- safe
- friendly
- extensibe
- simple
- tested (100% code coverage)
brief
-
VM managed types / C API
-
user defined types / extensibility system
- C API
- memory management
- garbage collection
-
development environment:
- WSL2/devcontainers
- Ubuntu 18.04.6 / 22.04.3 / 24/.04.2 LTS
- MSVC
-
C API generated docs (doxygen):
media links
-
streaming channels
music credits
updates
-
2023
-
added v1 core Virtual Machine (vm1) with types:
-
added support including:
- file IO
- string manupulation methods
- search
-
info
Listimplementations- code coverage
- coverage hot-reload
- memory allocation playground
- automatic garbage collection implementation (GC)
- GTK GUI app demo ready to run on containerized environment
readme
repo is ready to run on containers, WSL, remote hosts.
remote development
- installation from git repo (manually)
Installs sources from git repo
git config --global user.name "$USER_NAME"
git config --global user.email "$USER_EMAIL"
git clone https://github.com/default-writer/c.git
clang
containers
manual installation (minimal install)
- init
Sets up primary/optional tools and git hooks
./bin/init.sh --optional
./bin/init.sh --hooks
- rexo
GTK GUI app development
setup
- add/update Visual Studio Code environment settings:
{
"name": "UI_MODE",
"value": "--ui"
}
]
- run command line build
./bin/build.sh --target gtk-experiment1 --clean
UI_MODE=--ui ./build/gtk-experiment1
shell scripting documentation
all shell scripts
- are self-documented
- placed in ./bin folders
- detects execution as user or root (sudo)
- runs with required and optional command-line parameters
log
local repos
support C project
sponsorship
support this project become a sponsor
2023
- added support for classes / inheritance (oberon exaple)
- added GC implementation
- added several list implementations
2022
- playing around with visibility in class declarations
documentation
initialization
- ./bin/init.sh --hooks
- ./bin/init.sh --optional
FAQ
-
Q: Ninja generator not known (windows build)
-
A: Download and Set Up Ninja Ninja for Windows
- Download the latest version from the official GitHub releases page
- Look for the ninja-win.zip file under the "Assets" section of the latest release.
- Extract the ninja.exe file from the zip archive.
- Create a new directory (e.g., C:\Tools\Ninja) and add it to your PATH.
- Place ninja.exe in a directory that is included in your system's PATH.
doxygen generated documentation
C API PDF(refman.pdf)
referential documentation
- nasa NASA PDF(p10.pdf)
- memory PDF(memory.pdf)
- list PDF(list.pdf)
- class PDF(class.pdf)
- history PDF(history)
- scripts PDF(scripts)
- labs PDF(labs)
resources
links
requirements
code
C standart
- The Current C Programming Language Standard - ISO/IEC 9899:2024 (C24)
- ISO/IEC 9899:2024 (en) -- N3220 working draft
- C23 (C standard revision)
guidelines
- C guidelines in development of critical code (refers to Secure Coding in C and C 2nd Edition, Robert C. Seacord).
- NASA guidlines (refers to The Power of Ten - Rules for Developing Safety Critical Code, Gerard J. Holzmann, NASA/JPL Laboratory for Reliable Software, Pasadena, CA 91109)
SAST Tools
PVS-Studio - static analyzer for C, C++, C#, and Java code.
funding
- etherium: 0x035ebC06C7e667200695Cf8FC3686EEBBBD5A452