c3c(1)

๐Ÿ“ฆ
version 0.8.5_1 ยท 2 versions
, in nixpkgs unstable

๐Ÿ’– NAME ๐Ÿ’–

c3c โ€” the compiler for the C3 programming language, manual section 1 of the User Commands pages. yes bestie, this is the whole thing, buckle up ๐ŸŽ€


โœจ SYNOPSIS โœจ

c3c [options ...] command [args ...]

that's it. that's the whole shape of it. options first, then the command, then whatever args that command wants ๐Ÿฆ‹


๐ŸŒธ DESCRIPTION ๐ŸŒธ

c3c is the compiler for the C3 language, and she does a lot โ€” compilation, project management, testing, and distribution all live in here. like, the commands available let you compile files, initialize projects, build targets, run benchmarks, clean build files, and more. she's the whole toolbox, not just the hammer ๐Ÿ’…


๐Ÿ‘‘ COMMANDS ๐Ÿ‘‘

okay so this is the menu of things you can actually ask her to do. pick one, she'll handle it โœจ

  • c3c compile file1 [file2 ...] โ€” compile files without a project, straight into an executable. no project scaffolding needed, we're free-spiriting it ๐Ÿฆ‹
  • c3c init project name โ€” initialize a brand new project structure. main character energy from day one ๐Ÿ’–
  • c3c init-lib library name โ€” same idea but for a library structure instead of an app ๐ŸŽ€
  • c3c build [target] โ€” build the target inside the current project ๐Ÿ”ฅ
  • c3c benchmark [target] โ€” run the benchmarks for the target in the current project. numbers go brrr ๐Ÿ“Š
  • c3c test [target] โ€” run the unit tests for the target in the current project. manifesting all green for you ๐Ÿงš
  • c3c clean โ€” clean all the build files. the great purge ๐Ÿ˜Œ
  • c3c run [target] [-- [arg1 ...]] โ€” run the target in the current project, and build it first if needed. anything after -- gets passed as args ๐Ÿซถ
  • c3c dist [target] โ€” clean and build a target for distribution. this is the going-out outfit version ๐Ÿ“ฆ
  • c3c clean-run [target] [-- [arg1 ...]] โ€” clean, then run the target. fresh slate, then go ๐Ÿ’…
  • c3c compile-run file1 [file2 ...] [-- [arg1 ...]] โ€” compile the files then immediately run the result, no waiting around โšก
  • c3c compile-only file1 [file2 ...] โ€” compile the files but do not perform linking. all the parse, none of the join ๐Ÿ™ˆ
  • c3c compile-benchmark file1 [file2 ...] โ€” compile files into a test-executable and run benchmarks. (yes, that's what the page says โ€” test-executable, benchmarks. I'm not making it up, I'm just reading it ๐Ÿ’€)
  • c3c compile-test file1 [file2 ...] โ€” compile files into a benchmark-executable and run unit tests. (again: benchmark-executable, unit tests. the page said it, not me ๐Ÿ˜ญ)
  • c3c static-lib file1 [file2 ...] โ€” compile files without a project into a static library ๐Ÿงฑ
  • c3c dynamic-lib file1 [file2 ...] โ€” compile files without a project into a dynamic library ๐ŸŒŠ
  • c3c vendor-fetch library ... โ€” fetches one or more libraries from the vendor collection. shopping spree, but make it deps ๐Ÿ›๏ธ
  • c3c project subcommand ... โ€” manipulate or view project files ๐Ÿ“
  • c3c fetch-sdk windows|macos|android ... โ€” fetches the SDK you need for cross-compiling. pick your windows, macos, or android era ๐ŸŒˆ
  • c3c docgen [path1 path2 ...] โ€” generate documentation for the project, or for specific files and directories. future you says thank you ๐Ÿ’–

๐Ÿ’… OPTIONS ๐Ÿ’…

this section is long, bestie. we're going through every single one, no skipping, no summarising. hydrate first ๐Ÿ“

๐ŸŽ€ Help & version vibes

  • -h, -hh, --help โ€” print the help. -h gives you the normal options, -hh gives you the full help. go -hh if you're feeling brave ๐Ÿ‘‘
  • -V, --version โ€” print version information. know your era โœจ

๐Ÿ”‡ Volume control

  • -q, --quiet โ€” silence unnecessary output. she's in her quiet luxury bag ๐Ÿคซ
  • -v, -vv, -vvv โ€” verbose output. -v for default verbose, and -vv / -vvv give you more information. escalating yapping, but useful ๐Ÿ“ข

๐Ÿงช Pipeline-stopper flags (stop early, peek inside)

  • -E โ€” lex only. just the tokens, ma'am ๐Ÿฌ
  • -P โ€” only parse and output the AST as JSON ๐ŸŒณ
  • -C โ€” only lex, parse and check. no further, we're just validating vibes โœ…

๐Ÿด I/O bits

  • - code... โ€” read code from standard in. yes, a lone dash then your code, piped right in ๐Ÿซถ
  • -o file โ€” write output to file ๐Ÿ“

๐Ÿ”ฅ Optimization levels (read these carefully, bestie)

  • -O0 โ€” safe, no optimizations, emit debug info ๐Ÿฃ
  • -O1 โ€” safe, high optimization, emit debug info ๐Ÿš€
  • -O2 โ€” unsafe, high optimization, emit debug info โš ๏ธ
  • -O3 โ€” unsafe, high optimization, single module, emit debug info ๐Ÿงจ
  • -O4 โ€” unsafe, highest optimization, relaxed maths, single module, emit debug info, no panic messages ๐Ÿ’€
  • -O5 โ€” unsafe, highest optimization, fast maths, single module, emit debug info, no panic messages, no backtrace ๐ŸŒ‹
  • -Os โ€” unsafe, high optimization, small code, single module, no debug info, no panic messages ๐Ÿƒ
  • -Oz โ€” unsafe, high optimization, tiny code, single module, no debug info, no panic messages, no backtrace ๐Ÿœ
fr fr, notice how -O2 and up are unsafe. that's not decorative, that's the actual deal. safety is a setting here, not a default you can assume ๐ŸŒธ

๐Ÿท๏ธ Feature flags

  • -D name โ€” add feature flag name โž•
  • -U name โ€” remove feature flag name โž–

๐ŸŒˆ Info about the thing itself

  • --about โ€” prints a short description of C3 ๐Ÿ’–
  • --build-env โ€” prints build environment information. this one's only valid in combination with a command such as 'compile' ๐Ÿ‘€

๐Ÿ“‚ Where stuff goes & where stuff's found

  • --run-dir dir โ€” set the directory from where to run the binary. only for run and compile-run ๐Ÿƒโ€โ™€๏ธ
  • --libdir dir โ€” add this directory to the c3l library search paths ๐Ÿ”
  • --lib name โ€” add this c3l library to the compilation ๐Ÿงฉ
  • --sources file1 [file2 ...] โ€” add these additional sources to the compilation ๐Ÿ“š
  • --validation= option โ€” how strict the code validation is: lenient (default), strict, obnoxious (very strict). yes, obnoxious is the real name ๐Ÿ˜ญ
  • --stdlib dir โ€” use this directory as the C3 standard library path ๐Ÿ›๏ธ
  • --no-entry โ€” do not generate (or require) a main function. no entry point, no problem ๐Ÿšช
  • --path dir โ€” use this as the base directory for the current command ๐Ÿงญ
  • --template template โ€” select the template for 'init': "exe", "static-lib", "dynamic-lib" or a path ๐ŸŽจ

๐Ÿง  Resource-ish knobs

  • --symtab value โ€” sets the preferred symtab size ๐Ÿ“
  • --max-mem value โ€” set the maximum memory size (in MB) ๐Ÿงฎ

๐Ÿƒ Run behaviour

  • --run-once โ€” after running the output file, delete it immediately. one and done, iconic and terrifying ๐Ÿ’…
  • --suppress-run โ€” build but do not run on test/benchmark options ๐Ÿ™…โ€โ™€๏ธ
  • --trust= option โ€” trust level: none (default), include ($include allowed), full ($exec / exec allowed) ๐Ÿ”

๐Ÿ“ Directory overrides (the whole drawer)

  • --output-dir dir โ€” override the general output directory ๐Ÿ“ฆ
  • --build-dir dir โ€” override the build output directory ๐Ÿ—๏ธ
  • --obj-out dir โ€” override the object file output directory ๐Ÿงฑ
  • --script-dir dir โ€” override the base directory where scripts are searched ๐Ÿ“œ
  • --exec-dir dir โ€” override the base directory for $exec and exec โšก
  • --llvm-out dir โ€” override the llvm output directory for '--emit-llvm' ๐ŸŒ™
  • --asm-out dir โ€” override the asm output directory for '--emit-asm' ๐Ÿ”ง
  • --header-output dir โ€” override the header file output directory when building libraries ๐Ÿ“„

๐Ÿงพ Emit this, emit that

  • --emit-llvm โ€” emit LLVM IR as a .ll file per module ๐Ÿ’œ
  • --emit-asm โ€” emit asm as a .s file per module ๐Ÿ› ๏ธ
  • --obj โ€” emit object files (enabled by default) โœ…
  • --no-obj โ€” do not output object files; this is only valid for compile-only ๐Ÿšซ
  • --no-headers โ€” do not generate C headers when building a library ๐Ÿ™ˆ

๐ŸŽฏ Targets & threads

  • --target target โ€” compile for a particular architecture + OS target ๐ŸŒ
  • --threads number โ€” set the number of threads to use for compilation ๐Ÿงต

๐Ÿ›ก๏ธ Safety & panics

  • --safe= yes|no โ€” turn safety (contracts, runtime bounds checking, null pointer checks etc) on or off ๐Ÿฆบ
  • --panic-msg= yes|no โ€” turn panic message output on or off ๐Ÿ˜ฑ

โš™๏ธ Optimization fine-tuning

  • --optlevel= option โ€” code optimization level: none, less, more, max ๐Ÿ“ˆ
  • --optsize= option โ€” code size optimization: none, small, tiny ๐Ÿค
  • --unroll-loops= yes|no โ€” enable loop unrolling ๐Ÿ”
  • --loop-vectorize= yes|no โ€” enable loop auto-vectorization ๐ŸŽฏ
  • --slp-vectorize= yes|no โ€” enable SLP (superword-level parallelism) auto-vectorization ๐Ÿงฌ
  • --merge-functions= yes|no โ€” enable function merging ๐Ÿซ‚
  • --function-sections= yes|no โ€” place each function in its own section, so the linker can discard unused ones (no effect on Mach-O) ๐Ÿ—‚๏ธ
  • --data-sections= yes|no โ€” place each global variable in its own section, so the linker can discard unused ones (no effect on Mach-O) ๐Ÿ—ƒ๏ธ
  • --single-module= yes|no โ€” compile all modules together, enables more inlining ๐Ÿงฉ
  • --show-backtrace= yes|no โ€” show detailed backtrace on segfaults ๐Ÿ’€

๐Ÿฉบ Diagnostics & warnings

  • --lsp โ€” emit data about errors suitable for a LSP ๐Ÿง 
  • --print-large-functions โ€” print functions with large compile size ๐Ÿ˜
  • --warn-deadcode= yes|no|error โ€” print warning on dead-code: yes, no, error ๐ŸงŸ
  • --warn-recursivecontracts= yes|no|error โ€” print warning on recursive contracts: yes, no, error ๐Ÿ”„
  • --warn-methodvisibility= yes|no|error โ€” print warning when methods have ignored visibility attributes ๐Ÿ‘€
  • --warn-methodsnotresolved= yes|no|error โ€” print warning on methods not resolved when accessed: yes, no, error ๐Ÿง
  • --warn-deprecation= yes|no|error โ€” print warning when using deprecated code and constructs: yes, no, error ๐Ÿ•ฐ๏ธ
  • --warn-builtin= yes|no|error โ€” print warning when using builtin functions outside of the stdlib: yes, no, error ๐Ÿ 

๐Ÿž Debug info

  • -g โ€” emit debug info ๐Ÿชฒ
  • -g0 โ€” emit no debug info ๐Ÿšซ

๐ŸŽจ Pretty output

  • --ansi= yes|no โ€” set colour output using ansi on/off, default is to try to detect it ๐ŸŒˆ
  • --echo-prefix arg โ€” sets the prefix for any output using '$echo', defaults to 'c3c:' ๐Ÿ’ฌ

๐Ÿงช Test runner settings

  • --test-filter arg โ€” set a filter when running tests, running only matching tests ๐ŸŽฃ
  • --test-breakpoint โ€” when running tests, trigger a breakpoint on failure ๐Ÿ›‘
  • --test-nosort โ€” do not sort tests ๐Ÿ”€
  • --test-noleak โ€” disable tracking allocator and memory leak detection for tests ๐Ÿšฐ
  • --test-show-output โ€” disable test stdout capturing, all tests can print as they run ๐Ÿ“ข
  • --test-nocapture โ€” disable test stdout capturing, all tests can print as they run, same as --test-show-output ๐Ÿ‘ฏโ€โ™€๏ธ
  • --test-quiet โ€” run tests without printing full names, printing output only on failure ๐Ÿค
  • --test-log-level= verbose|debug|info|warn|error|critical โ€” set log priority when running tests ๐Ÿ“Š

๐Ÿ“ˆ Benchmark output

  • --benchmark-csv-report โ€” print a CSV report after benchmarks have completed ๐Ÿ“‹

๐Ÿ”— Linking & libraries

  • -l library โ€” link with the static or dynamic library provided ๐Ÿ”Œ
  • -L library dir โ€” append the directory to the linker search paths ๐Ÿ—บ๏ธ
  • -z argument โ€” send the argument as a parameter to the linker ๐Ÿ“จ
  • --cc path โ€” set C compiler (for C files in projects and use as system linker) ๐Ÿ› ๏ธ
  • --linker= option [path] โ€” linker: builtin, cc, custom (default is 'cc'), and 'custom' requires a path โš“
  • --use-stdlib= yes|no โ€” include the standard library (default: yes) ๐Ÿ“š
  • --link-libc= yes|no โ€” link libc and other default libraries (default: yes) ๐Ÿงท
  • --custom-libc= yes|no โ€” set to true if a custom libc implementation is provided (default: no) ๐Ÿงช
  • --emit-stdlib= yes|no โ€” output files for the standard library (default: yes) ๐Ÿ›๏ธ
  • --emit-only file โ€” output only the file matching file ๐ŸŽฏ

๐Ÿท๏ธ Symbol name overrides

  • --panicfn name โ€” override the panic function name ๐Ÿ’ฅ
  • --testfn name โ€” override the test runner function name ๐Ÿงช
  • --benchfn name โ€” override the benchmark runner function name โฑ๏ธ

๐Ÿงญ Codegen & cpu

  • --reloc= option โ€” relocation model: none, pic, PIC, pie, PIE ๐Ÿงฑ
  • --cpu-flags string โ€” add/remove cpu flags from the default, e.g. '+a,-b' ๐ŸŽ›๏ธ
  • --x86cpu= option โ€” set general level of x64 cpu: baseline, ssse3, sse4, avx1, avx2-v1, avx2-v2 (Skylake/Zen1+), avx512 (Icelake/Zen4+), native ๐Ÿ–ฅ๏ธ

okay that's the end of part 1, and part 2 is coming right up ๐Ÿซถ

  • --x86vec= option โ€” caps the fanciest vector type the compiler will use. Your options: none, mmx, sse, avx, avx512, default. Pick your vibe ๐Ÿ’…
  • --riscv-abi= option โ€” sets which RISC-V ABI you're on: int-only, float, or double. choose wisely bestie.
  • --riscv-cpu= option โ€” picks the general level of your RISC-V cpu: rvi (that's the default for 32-bit), rvimac, rvimafc, rvgc (default for 64-bit), rvgcv. lowkey a whole alphabet soup but slay ๐ŸŒธ
  • --memory-env= option โ€” sets the memory environment: normal, small, tiny, none. it's giving "how much room do we have to breathe" ๐Ÿซถ
  • --strip-unused= yes|no โ€” strips unused code and globals out of the output. default is yes, so the compiler is already doing the cleanup for you โœจ
  • --fp-math= option โ€” floating point math behaviour: strict, relaxed, fast. strict is the goody-two-shoes, fast is the reckless main character ๐Ÿ˜ญ
  • --win64-simd= option โ€” Win64 SIMD ABI: array, full.
  • --win-debug= option โ€” picks the debug output format on Windows: codeview or dwarf. default is codeview ๐ŸชŸ
  • --max-vector-size number โ€” the biggest vector bit size you're allowed to use. default is 4096, which is already huge ngl.
  • --max-stack-object-size number โ€” biggest size a stack object can be, in KB. default is 128 ๐Ÿงš
  • --max-macro-iterations number โ€” the max number of times a macro loop can go around before it gets told to chill. default is 1048575, so like... a lot ๐Ÿ’€
  • --print-linking โ€” prints the linker arguments. nosy but make it fashion.
  • --benchmarking โ€” runs the built-in benchmarks ๐Ÿ”ฅ
  • --testing โ€” runs the built-in tests. very responsible of you tbh ๐ŸŽ€
  • --list-attributes โ€” lists every attribute.
  • --list-builtins โ€” lists every builtin.
  • --list-keywords โ€” lists every keyword.
  • --list-operators โ€” lists every operator.
  • --list-precedence โ€” lists the operator precedence order, aka who goes first ๐Ÿ‘‘
  • --list-project-properties โ€” lists all the available keys used in project.json files.
  • --list-manifest-properties โ€” lists all the available keys used in manifest.json files.
  • --list-targets โ€” lists every architecture the compiler supports ๐ŸŒˆ
  • --list-type-properties โ€” lists all type properties.
  • --list-asm โ€” lists every asm instruction for the current target. heads up: you must use it together with a compilation command like compile or build, or it just won't hit ๐Ÿซถ
  • --print-output โ€” prints the object files it created to stdout.
  • --print-input โ€” prints the C3 files it was given to stdout.
  • --win-sdk dir โ€” sets the directory for Windows system library files when you're cross compiling.
  • --wincrt= option โ€” Windows CRT linking: none, static-debug, static, dynamic-debug (this one's the default if debug info is enabled), dynamic (default). lots of options but periodt ๐Ÿ’…
  • --windef file โ€” uses a Windows def file for function exports instead of dllexport.
  • --win-vs-dirs dir;dir โ€” overrides the Windows VS detection. note the semicolon between the two dirs, bestie โ€” it's not a typo โœจ
  • --win-subsystem= subsystem โ€” the Windows subsystem: console (default), windows (default if @winmain is present), native, posix, boot, efi-app, efi-boot, efi-rom or efi-runtime. the efi girlies are eating ๐Ÿ“
  • --macos-sdk dir โ€” sets the directory for the MacOS SDK when you're cross compiling.
  • --macos-min-version ver โ€” sets the minimum MacOS version to compile for.
  • --macos-sdk-version ver โ€” sets the MacOS SDK version compiled for.
  • --linux-libc= host|gnu|musl โ€” sets which libc to use on Linux. defaults to host ๐Ÿง
  • --linux-crt dir โ€” sets the directory used for finding crt1.o and related files.
  • --linux-crtbegin dir โ€” sets the directory used for finding crtbegin.o and related files.
  • --android-ndk dir โ€” sets the NDK directory location.
  • --android-api ver โ€” sets the Android API version.
  • --bsd-sysroot dir โ€” sets the BSD sysroot directory.
  • --sanitize= option โ€” turns on a sanitizer: address, memory, thread. friendship bracelets for your memory bugs ๐Ÿ’–

โœจ EXAMPLES โœจ

bestie these are copy-paste ready, go off ๐Ÿฆ‹

Create a project:

c3c init new_project

Create a library project:

c3c init-lib new_library

Compile a file:

c3c compile main.c3

Build the current project:

c3c build

Run tests for the current project:

c3c test

that's the whole page, no cap ๐ŸŽ€ the C3 Compiler was being iconic on 2026-07-03, and yes the man page footer literally reads c3c(1) โ€” she's a classic, iykyk ๐Ÿ’œ

๐Ÿ“ฆ where this page comes from