A shebang-friendly script that compiles and executes single C99, C11, and C++ files like interpreted scripts.
c99sh is a command-line tool that compiles and executes single C99, C11, and C++ files as if they were interpreted scripts. It solves the problem of C/C++ being cumbersome for quick prototyping by allowing developers to write executable scripts with shebang lines, automating the compilation and execution process. This enables rapid testing and one-off tasks without the overhead of traditional build systems.
C and C++ developers who need to write quick prototypes, one-off scripts, or educational examples without setting up full build systems. It's also useful for system programmers who want to leverage C libraries in script-like workflows.
Developers choose c99sh because it uniquely bridges scripting convenience with C/C++ performance, offering shebang support, control files for dependency management, and dual compatibility with standard compilation. It eliminates the translation phase between scripting languages and C ABI code for prototyping.
A shebang-friendly script for "interpreting" single C99, C11, and C++ files, including rcfile support.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Enables C/C++ files to be executed directly with shebang lines, as shown in the hello example, bridging the gap between compiled and interpreted languages for quick tasks.
Uses c99shrc files to define compiler flags and pkg-config dependencies, simplifying library integration for scripts, demonstrated with GSL and SQLite in the examples.
Allows source files to be both interpreted via c99sh and compiled traditionally using the #if 0 trick, maintaining compatibility with standard workflows.
Supports running code snippets from the command line with -e and -sm options, useful for rapid testing without creating files, as illustrated with HERE documents.
Every invocation requires compilation, which can be slow for C++ or large files, noted in the README as 'prohibitively expensive' without caching via -x.
The README admits that quote escaping for -e options 'could use some printf love,' leading to potential issues with complex arguments or strings.
Relies on shebang lines and standard Unix tools like pkg-config, with no mention of Windows support, limiting cross-platform usability.