C/C++
C
1972 / 1979
total mess / mix. to separate out
- http://en.wikipedia.org/wiki/C_(programming_language) - a general-purpose, imperative computer programming language, supporting structured programming, lexical variable scope and recursion, while a static type system prevents many unintended operations. By design, C provides constructs that map efficiently to typical machine instructions, and therefore it has found lasting use in applications that had formerly been coded in assembly language, including operating systems, as well as various application software for computers ranging from supercomputers to embedded systems.
C was originally developed by Dennis Ritchie between 1969 and 1973 at AT&T Bell Labs, and used to re-implement the Unix operating system. It has since become one of the most widely used programming languages of all time, with C compilers from various vendors available for the majority of existing computer architectures and operating systems. C has been standardized by the American National Standards Institute (ANSI) since 1989 (see ANSI C) and subsequently by the International Organization for Standardization (ISO).
- ACM Queue: C Is Not a Low-level Language
- ISO-9899.info - ##C on Freenode
Varieties
- https://en.wikipedia.org/wiki/ANSI_C - aka C89
- The GNU C Reference Manual - a reference manual for the C programming language as implemented by the GNU Compiler Collection (GCC). Specifically, this manual aims to document: The 1989 ANSI C standard, commonly known as “C89”, The 1999 ISO C standard, commonly known as “C99”, to the extent that C99 is implemented by GCC, The current state of GNU extensions to standard C
- Cerberus - project developing a semantic model for a substantial fragment of C. Where the ISO C11 standard is clear and corresponds with practice, Cerberus aims to follow that. Where there are differences, chiefly in the memory layout model (the behaviour of pointers, pointer arithmetic, uninitialised values, etc.), we aim to clarify the de facto standards, understand how the ISO standard could be reconciled with them, and provide options that capture both.[2]
- Cerberus - a tool for exploring the semantics of C the programming language.
- Cosmopolitan C Library - makes C a build-once run-anywhere language, similar to Java, except it doesn't require interpreters or virtual machines be installed beforehand. Cosmo provides the same portability benefits as high-level languages like Go and Rust, but it doesn't invent a new language and you won't need to configure a CI system to build separate binaries for each operating system. What Cosmopolitan focuses on is fixing C by decoupling it from platforms, so it can be pleasant to use for writing small unix programs that are easily distributed to a much broader audience.
Guides
- C Primer - This is not a theoretical C language specifications document. It is a practical primer for the vast majority of real life cases of C usage that are relevant to EFL on todays common architectures. It covers application executables and shared library concepts and is written from a Linux/UNIX perspective where you would have your code running with an OS doing memory mappings and probably protection for you. It really is fundamentally not much different on Android, iOS, OSX or even Windows. It won't cover esoteric details of “strange architectures”. It pretty much covers C as a high level assembly language that is portable across a range of modern architectures.
- Beej's Guide to C Programming - Library Reference
- Learn C The Hard Way will fill in the "beginning programmer" gap in the literature on the C Programming language. It will teach good modern C programming practices and avoid habits that lead to buffer overflows, security defects, and other problems that even experienced programmers cause. This book is designed for: Students who have read LPTHW or LRTHW. Programmers with skill in one other "scripting" language. Programmers who need to relearn C. Objective-C programmers who want better C skills. People who like a challenge.
- Advanced Linux Programming book (PDF)
- C programming language coding guidelines - Eric Laroche, 1998 - This paper gives a comprehensive insight into the author's guidelines in C programming. Many aspects that are needed to define these guidelines are thoroughly discussed. The paper provides much background information needed for the decisions about do's and don't's in C coding.
- Object-Oriented Programming Using C++ - and the associated instructional material were created for a course by the same name at Weber State University in Ogden, Utah. The course, CS 1410, follows CS 1400, which is an introductory programming course based on the Java programming language. Throughout the text, C++ and Java are often compared in an attempt to help students better understand the behavior of C++ based on their prior understanding of Java. The comparison also highlights the similarities between the two languages while making students aware of their (often subtle) differences.
- How to Structure C Projects: These Best Practices Worked for Me | Hacker News - "I've seen it written that C++ solves problems by extending the language and C solves problems by writing more C and that sounds about right."
Debugging
- GNU cflow - analyzes a collection of C source files and prints a graph, charting control flow within the program. GNU cflow is able to produce both direct and inverted flowgraphs for C sources. Optionally a cross-reference listing can be generated. Two output formats are implemented: POSIX and GNU (extended).
- Cflow2vcg - converts the result of the cflow utility in a VCG format. It offers the ability to view graphically the call-graph of sources, and import it in documentation.
- https://github.com/bombela/backward-cpp - A beautiful stack trace pretty printer for C++
- https://sourceforge.net/projects/log4c - ANSI C functions and macros for flexible logging to files and other destinations.
- unifdef - selectively remove C preprocessor conditionals - selectively processes conditional C preprocessor #if and #ifdef directives. It removes from a file both the directives and the additional text that they delimit, while otherwise leaving the file alone. It is useful for avoiding distractions when studying code that uses #ifdef heavily for portability: my original motivation was to understand xterm's pty handling code. It can be used as a lightweight preprocessor; for example the Linux kernel uses unifdef to strip out #ifdef __KERNEL__ sections from the headers it exports to userland. You can use unifdef with languages other than C; for example UIT, a publisher in Cambridge where I live, uses unifdef with LaTeX.
- https://github.com/andrewrk/malcheck - Test your code with malcheck to make sure it handles out of memory conditions correctly.
- https://github.com/katef/ivv - C language Independent Verification & Validation
Runtime
- https://en.wikipedia.org/wiki/crt0 - a set of execution startup routines linked into a C program that performs any initialization work required before calling the program's main function. It generally takes the form of an object file called crt0.o, often written in assembly language, which is automatically included by the linker into every executable file it builds.
- https://github.com/jart/cosmopolitan - Cosmopolitan Libc makes C a build-once run-anywhere language, like Java, except it doesn't need an interpreter or virtual machine. Instead, it reconfigures stock GCC and Clang to output a POSIX-approved polyglot format that runs natively on Linux + Mac + Windows + FreeBSD + OpenBSD + NetBSD + BIOS with the best possible performance and the tiniest footprint imaginable.
Syntax
By Dan Gookin from C All-in-One Desk Reference For Dummies
C programs consist of variables and functions. The language consists of expressions and statements. Expressions are used to compute new values which can be either used directly – as in function arguments – or assigned to a variable. Statements are assignments, flow control, declarations, or blocks. Flow control is conditional (if then else), looping (for, while, or do..while), or multi-way conditional (switch). Blocks are enclosed in braces ( { … } ) and define a local scope. Declarations create variable instances.
C is a pretty old language so there weren’t a lot of neat ideas in play to steal. Block structuring was and is and is very nice. Any collection of statements within a function which is wrapped in braces is a block. The block creates a local scope which exists until the closing brace. This means you can define local variables which shadow external variables quite freely. This makes you code easier to read and safer to develop because you can use your locals locally and know that anything else which is used must be defined in a higher level scope.
One thing you cannot do in C’s blocks is define functions. C does not support nested functions, so you don’t get closures. [of course you can implement closures in C by writing a lisp interpreter and implementing closures in lisp and then . . . – which is how closures are implemented in Ruby and Python and a lot of other languages (which are actually implemented in C or some other similarly lower level language)]
Pointers – variables which contain addresses.
C has an implicit call stack and a heap for dynamically managed memory. The call stack is managed automatically: it get’s bigger when a function is called and smaller when the function returns. The heap is managed by you.
You allocate memory by calling a function which grabs some and reserves it for you. You get a pointer to the memory. You specified how big it is supposed to be and you’re supposed to be smart enough to remember that.
You free memory by calling a function (‘free(pointer)’) which returns the memory to the free list. If you forget to do this and forget the address of the allocated memory, you create a ‘memory leak’ while your program is running. If you free some memory which is still in use – either continuously or at some later time – interesting and bad things can happen.
Standard library
- https://en.wikipedia.org/wiki/C_standard_library - the standard library for the C programming language, as specified in the ANSI C standard. It was developed at the same time as the C library POSIX specification, which is a superset of it. Since ANSI C was adopted by the International Organization for Standardization, the C standard library is also called the ISO C library. The C standard library provides macros, type definitions and functions for tasks such as string handling, mathematical computations, input/output processing, memory management, and several other operating system services.
- https://en.wikipedia.org/wiki/struct_(C_programming_language) - a complex data type declaration that defines a physically grouped list of variables to be placed under one name in a block of memory, allowing the different variables to be accessed via a single pointer, or the struct declared name which returns the same address. The struct can contain many other complex and simple data types in an association, so is a natural organizing type for records like the mixed data types in lists of directory entries reading a hard drive (file length, name, extension, physical (cylinder, disk, head indexes) address, etc.), or other mixed record type (patient names, address, telephone... insurance codes, balance, etc.).
The C struct directly corresponds to the assembly language data type of the same use, and both reference a contiguous block of physical memory, usually delimited (sized) by word-length boundaries. Language implementations which could utilize half-word or byte boundaries (giving denser packing, using less memory) were considered advanced in the mid-eighties. Being a block of contiguous memory, each variable within is located a fixed offset from the index zero reference, the pointer. As an illustration, many BASIC interpreters once fielded a string data struct organization with one value recording string length, one indexing (cursor value of) the previous line, one pointing to the string data.
- The Lost Art of C Structure Packing - Eric S. Raymond [4]
REPL
- https://github.com/hexagonal-sun/bic - A C interpreter and API explorer.
- https://github.com/elf-audio/cppsketch - Simple system for hot-reloading C++ classes in order to sketch ideas and algorithms
to sort
- https://github.com/nickolas360/autoheaders - Automatically generate headers from C code.
- https://en.wikipedia.org/wiki/unistd.h - the name of the header file that provides access to the POSIX operating system API.
- The Descent to C - This article attempts to give a sort of ‘orientation tour’ for people whose previous programming background is in high (ish) level languages such as Java or Python, and who now find that they need or want to learn C.
- A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux
- Hello from a libc-free world! (Part 1)
- https://github.com/j3ffhubb/libshds - provides a single header library of useful data structures with good performance and scalability characteristics, while being generic and object-oriented. The implementation is intended to be portable across as many platforms, compilers and C standards as possible.
Wherever practical, the library avoids implementing functions for data structures if the function does not scale well, and instead focuses on implementing functions that scale in O(1) if possible, or at least algorithms that scale in O(log n) (for searching, etc...) or O(n log n) (for sorting). libshds is not meant to be a full-blown framework to make C into a high(er) level language, but rather a lightweight and useful tool to ease the development of low-level code that scales.
int foo[5]; // foo is an array of 5 ints char *foo; // foo is a pointer to char double foo(); // foo is a function returning a double
- The ``Clockwise/Spiral Rule - There is a technique known as the ``Clockwise/Spiral Rule which enables any C programmer to parse in their head any C declaration! [7]
C has little namespacing functionality at the language level. In the case of identifiers (functions and variables), there is one namespace, subject to scoping rules. And any identifier that must be shared between two compilation units is necessarily shared between them all: when you “extern” an identifier, you are using the link-level namespace.
The common workaround to C’s lack of namespaces is to use a standard name prefix for each module. The prefix indicates the app, library or module the name belongs to. For example, in Subversion you have names like svn_fs_initialize — this indicates that the function belongs to the svn_fs library. Subversion describes several layers of namespacing conventions. svn_fs_initialize is an example of a name in the public API. Names that need to visible to other modules within a single Subversion library use a double underscore to separate the namespace, for example, svn_fs_base__dag_get_node. Finally, non-exported functions used within a single module do not use a prefix.
- Talloc is a hierarchical, reference counted memory pool system with destructors. It is built atop the C standard library and it defines a set of utility functions that altogether simplifies allocation and deallocation of data, especially for complex structures that contain many dynamically allocated elements such as strings and arrays.
- Comprehensive C Archive Network (CCAN) - That nice snippets of C code should be moved out of junkcode directories and exposed to a wider world, where they can become something useful.
- Klib - a Generic Library in C
- https://github.com/Taymindis/lfqueue - lock-free FIFO queue by C native built it, easy built cross platform(no extra dependencies needed) , guarantee thread safety memory management ever!
- The GNU MPFR Library - a C library for multiple-precision floating-point computations with correct rounding. MPFR has continuously been supported by the INRIA and the current main authors come from the Caramba and AriC project-teams at Loria (Nancy, France) and LIP (Lyon, France) respectively; see more on the credit page. MPFR is based on the GMP multiple-precision library.
- https://github.com/RandyGaul/cute_headers - Collection of cross-platform one-file C/C++ libraries with no dependencies, primarily used for games
- musl provides standard C/POSIX library and extensions, consistent quality and implementation behaviour from tiny embedded systems to full-fledged servers. Minimal machine-specific code means less chance of breakage on minority architectures and better success with “write once run everywhere” C development. musl's efficiency is unparalleled in Linux libc implementations. Designed from the ground up for static linking, musl carefully avoids pulling in large amounts of code or data that the application will not use. Dynamic linking is also efficient; by integrating the entire standard library implementation, including threads, math, and even the dynamic linker itself into a single shared object, most of the startup time and memory overhead of dynamic linking have been eliminated.
- https://github.com/JulNadeauCA/libagar - Cross-Platform GUI Toolkit (stable)
- https://github.com/TheAlgorithms/C-Plus-Plus - collection of open-source implementation of a variety of algorithms implemented in C++ and licensed under MIT License. These algorithms span a variety of topics from computer science, mathematics and statistics, data science, machine learning, engineering, etc.. The implementations and the associated documentation are meant to provide a learning resource for educators and students. Hence, one may find more than one implementation for the same objective but using a different algorithm strategies and optimizations.
- https://github.com/DigitalInBlue/Celero - C++ Benchmark Authoring Library/Framework
Contrib
- Cello - a library that brings higher level programming to C. By acting as a modern, powerful runtime system Cello makes many things easy that were previously impractical or awkward in C such as: Generic Data Structures, Polymorphic Functions, Interfaces / Type Classes, Constructors / Destructors, Optional Garbage Collection, Exceptions, Reflection [10]
- Boost.Hana - a header-only library for C++ metaprogramming suited for computations on both types and values. The functionality it provides is a superset of what is provided by the well established Boost.MPL and Boost.Fusion libraries. By leveraging C++11/14 implementation techniques and idioms, Hana boasts faster compilation times and runtime performance on par or better than previous metaprogramming libraries, while noticeably increasing the level of expressiveness in the process. Hana is easy to extend in a ad-hoc manner and it provides out-of-the-box inter-operation with Boost.Fusion, Boost.MPL and the standard library.
- https://github.com/struct/isoalloc - A general purpose memory allocator that implements an isolation security strategy to mitigate memory safety issues while maintaining good performance
- https://github.com/nothings/stb - stb single-file public domain libraries for C/C++
- https://github.com/iboB/dynamix - A new take on polymorphism in C++
- https://github.com/attractivechaos/klib - standalone and lightweight C library distributed under MIT/X11 license. Most components are independent of external libraries, except the standard C library, and independent of each other. Klib strives for efficiency and a small memory footprint. Some components, such as khash.h, kbtree.h, ksort.h and kvec.h, are among the most efficient implementations of similar algorithms or data structures in all programming languages, in terms of both speed and memory use.
- https://github.com/google/wuffs - Wrangling Untrusted File Formats Safely
- https://github.com/gpakosz/whereami - Locate the current executable and the current module/library on the file system
- https://github.com/leahneukirchen/libste - C string library based on string ends
- https://github.com/antirez/smaz - a simple compression library suitable for compressing very short strings. General purpose compression libraries will build the state needed for compressing data dynamically, in order to be able to compress every kind of data. This is a very good idea, but not for a specific problem: compressing small strings will not work
- libevent – an event notification library. The libevent API provides a mechanism to execute a callback function when a specific event occurs on a file descriptor or after a timeout has been reached. Furthermore, libevent also support callbacks due to signals or regular timeouts. libevent is meant to replace the event loop found in event driven network servers. An application just needs to call event_dispatch() and then add or remove events dynamically without having to change the event loop. Currently, libevent supports /dev/poll, kqueue(2), event ports, POSIX select(2), Windows select(), poll(2), and epoll(4).
- libev - A full-featured and high-performance (see benchmark) event loop that is loosely modelled after libevent, but without its limitations and bugs. It is used in GNU Virtual Private Ethernet, rxvt-unicode, auditd, the Deliantra MORPG Server and Client, and many other programs. Features include child/pid watchers, periodic timers based on wallclock (absolute) time (in addition to timers using relative timeouts), as well as epoll/kqueue/event ports/inotify/eventfd/signalfd support, fast timer management, time jump detection and correction, and ease-of-use. It can be used as a libevent replacement using its emulation API or directly embedded into your programs without the need for complex configuration support. A full-featured and well-documented perl interface is also available.
- https://github.com/rxi/dyad - an asynchronous networking library which aims to be lightweight, portable and easy to use. It can be used both to create small standalone servers and to provide network support to existing project [11]
- https://github.com/rcliftonharvey/rchundenormal - Class for scoped denormal number protection in pure C++
- FFTW is a C subroutine library for computing the discrete Fourier transform (DFT) in one or more dimensions, of arbitrary input size, and of both real and complex data (as well as of even/odd data, i.e. the discrete cosine/sine transforms or DCT/DST). We believe that FFTW, which is free software, should become the FFT library of choice for most applications.
- https://github.com/avaneev/r8brain-free-src - High-quality pro audio resampler / sample rate converter C++ library. Very fast, for both audio resampling and time-series interpolation.
- Simplified Wrapper and Interface Generator - a software development tool that connects programs written in C and C++ with a variety of high-level programming languages. SWIG is used with different types of target languages including common scripting languages such as Javascript, Perl, PHP, Python, Tcl and Ruby. The list of supported languages also includes non-scripting languages such as C#, D, Go language, Java including Android, Lua, OCaml, Octave, Scilab and R. Also several interpreted and compiled Scheme implementations (Guile, MzScheme/Racket) are supported. SWIG is most commonly used to create high-level interpreted or compiled programming environments, user interfaces, and as a tool for testing and prototyping C/C++ software. SWIG is typically used to parse C/C++ interfaces and generate the 'glue code' required for the above target languages to call into the C/C++ code. SWIG can also export its parse tree in the form of XML. SWIG is free software and the code that SWIG generates is compatible with both commercial and non-commercial projects.
- https://github.com/swig/swig - a compiler that integrates C and C++ with languages including Perl, Python, Tcl, Ruby, PHP, Java, C#, D, Go, Lua, Octave, R, Scheme (Guile, MzScheme/Racket, CHICKEN), Scilab, Ocaml, Modula-3, Common Lisp (CLISP, Allegro CL, CFFI, UFFI) and Pike. SWIG can also export its parse tree into XML and Lisp s-expressions. SWIG reads annotated C/C++ header files and creates wrapper code (glue code) in order to make the corresponding C/C++ libraries available to the listed languages, or to extend C/C++ programs with a scripting language.
- https://github.com/xieyuheng/x-script - a pure postfix scripting language. It is trivially extensible by C, to be used as scripting language for C/C++ projects. It has NO garbage collector, it allocates and frees memory directly. It uses a simple linear type system for resource management.
- Programming Without Variables - Replace a loop by a function that uses only tail recursion. [12]
- CCAN - nice snippets of C code should be moved out of junkcode directories and exposed to a wider world, where they can become something useful. CCAN is loosely modelled after the successful CPAN project for Perl code development and sharing.
- https://github.com/mlabbe/nativefiledialog - A tiny, neat C library that portably invokes native file open and save dialogs.
- offbrand - collection of reference counted generic data structures written in pure C for the C programmer. The library is intended to relieve the common need to reimplement a standard data structures in an application. Never again need to write an automatically resizing array for your application specific datatype and use the vector included in offbrand instead.
- GMP is a free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating-point numbers. There is no practical limit to the precision except the ones implied by the available memory in the machine GMP runs on. GMP has a rich set of functions, and the functions have a regular interface. The main target applications for GMP are cryptography applications and research, Internet security applications, algebra systems, computational algebra research, etc.
- https://github.com/ned14/uthash - a hash table, implemented in C, supporting constant-time add/find/remove of C structures. Any structure having a unique, arbitrarily-typed key member can be hashed by adding a UT_hash_handle member to the structure and calling these macros
- https://github.com/rswier/c4 - C in four functions. An exercise in minimalism. char, int, and pointer types; if, while, return, and expression statements; just enough features to allow self-compilation and a bit more [13]
- https://github.com/wc-duck/getopt - simple getopt-implementation
- https://github.com/codeplea/tinyexpr - tiny recursive descent expression parser, compiler, and evaluation engine for math expressions
- Rollendurchmesserzeitsammler - a conservative garbage collector for realtime audio processing. Its main purpose is to make language implementations using conservative garbage collectors work reliably and efficiently in realtime.The collector is made to be a drop in replacement for Hans Boehm's conservative garbage collector for C and C++ (BDW-GC). This means that Rollendurchmesserzeitsammler makes it easier to use programming languages for realtime audio programming which uses BDW-GC.The garbage collection runs in a parallel thread and it operates on snapshots taken of the heap between processing blocks of audio data. Predictability and hard realtime are ensured by simulating worst case. CPU cache issues for computers with multiple processors should be handled appropriately.
- A garbage collector for C and C++ - The Boehm-Demers-Weiser conservative garbage collector can be used as a garbage collecting replacement for C malloc or C++ new. It allows you to allocate memory basically as you normally would, without explicitly deallocating memory that is no longer useful. The collector automatically recycles memory when it determines that it can no longer be otherwise accessed. A simple example of such a use is given here.
- Zix - a lightweight C library of portability wrappers and data structures. Itcan be used as a header-only library and incorporated piecemeal into projects,or built and installed as a normal shared or static library.
- https://gitlab.com/OpenMusicKontrollers/varchunk - Ringbuffer optimized for realtime event handling
- https://github.com/graphitemaster/incbin - Include binary files in your C/C++ applications with ease
- https://github.com/zserge/tray - Cross-platform, super tiny C99 implementation of a system tray icon with a popup menu.
- https://github.com/floooh/sokol - minimal cross-platform standalone C headers
- https://github.com/MrFrenik/gunslinger - C99, header-only framework for games and multimedia applications
to sort
- How 3.6 nearly broke PostgreSQL - How 3.6 nearly broke PostgreSQL
- Greg's diary--October 2012 - Yet Another ls option
- MetaC language extends C in a 100% backward compatible way with reflective features and techniques for refactoring, reconfiguring and modifying arbitrary C source code. Therefore, the extensions provide special metadata types for working with source code information, syntactical structures for the definiton of code templates, and metafunctions to gather information about source code and refactor, modify, delete, or insert code.
- CScout - a source code analyzer and refactoring browser for collections of C programs. It can process workspaces of multiple projects (we define a project as a collection of C source files that are linked together) mapping the complexity introduced by the C preprocessor back into the original C source code files. CScout takes advantage of modern hardware advances (fast processors and large memory capacities) to analyze C source code beyond the level of detail and accuracy provided by current compilers, linkers, and other source code analyzers. The analysis CScout performs takes into account the identifier scopes introduced by the C preprocessor and the C language proper scopes and namespaces.
- clib(1) - Package manager for the C programming language.
- C/C++ Open Source Package Manager - A distributed, open-source, C/C++ package manager.
- https://en.wikipedia.org/wiki/MINC - ("MINC is not C") is a data specification language written in the mid-1980s by a Princeton University graduate student named Lars Graf. It contains many (though not all) of the syntactical capabilities of the C programming language, and can be used to implement simple procedural programs that can be executed by a runtime parser (that is to say, MINC does not need to be compiled in any way). MINC continues to be used only in a handful of programs written in the 1980s (e.g. Real-Time Cmix). It has been for all intents and purposes superseded by modern scripting languages such as Perl, Python, and Tcl.
- A Second Life for (very old) C programs - a Proof Of Concept (POC) to transform DOS-style C programs into web services [16]
- Build Your Own Text Editor - an instruction booklet that shows you how to build a text editor in C. [17]
- The Underhanded C Contest - an annual contest to write innocent-looking C code implementing malicious behavior. In this contest you must write C code that is as readable, clear, innocent and straightforward as possible, and yet it must fail to perform at its apparent function. To be more specific, it should perform some specific underhanded task that will not be detected by examining the source code.
- kroki/XProbes: Explicit probes (XProbes) - static user space probes with natural data access. - a framework for static user space probes. It consists of a shared library libxprobes and its header files, and xprobes control utility. XProbes enables you to define static probe sites in the source code, and later attach probe modules to them. Probes may be attached both at application startup, and while the application is running. xprobes control utility provides commands for dynamic loading/unloading of probe modules, listing available sites and probes, and module enabling/disabling.
https://news.ycombinator.com/item?id=23376357
- https://github.com/ChaiScript/ChaiScript - one of the only embedded scripting language designed from the ground up to directly target C++ and take advantage of modern C++ development techniques, working with the developer how they would expect it to work. Being a native C++ application, it has some advantages over existing embedded scripting languages: It uses a header-only approach, which makes it easy to integrate with existing projects. It maintains type safety between your C++ application and the user scripts. It supports a variety of C++ techniques including callbacks, overloaded functions, class methods, and stl containers.
- https://github.com/spencertipping/jit-tutorial - First up, you probably don't want to. JIT, or more accurately "dynamic code generation," is typically not the most effective way to optimize a project, and common techniques end up trading away a lot of portability and require fairly detailed knowledge about processor-level optimization.
Compiling
cc source.c -o execurtablename
CFLAGS=-Wall -g
clean:
rm -f ex1
- C/C++ to Assembly v2 - Just paste your C or C++ code and see how each line is translated into assembly by gcc (GNU Compiler Collection). [18]
- QBE aims to be a pure C embeddable backend that provides 70% of the performance of advanced compilers in 10% of the code. Its small size serves both its aspirations of correctness and our ability to understand, fix, and improve it. It also serves its users by providing trivial integration and great flexibility. [19]
Interpreted
- Cling - an interactive C++ interpreter, built on the top of LLVM and Clang libraries. Its advantages over the standard interpreters are that it has command line prompt and uses just-in-time (JIT) compiler for compilation. Many of the developers (e.g. Mono in their project called CSharpRepl) of such kind of software applications name them interactive compilers.One of Cling's main goals is to provide contemporary, high-performance alternative of the current C++ interpreter in the ROOT project - CINT. The backward-compatibility with CINT is major priority during the development.
C++
1983
- https://github.com/shafik/cpp_youtube_channels - Listing of C++ Youtube channels for conferences and user groups
https://github.com/fffaraz/awesome-cpp - A curated list of awesome C++ (or C) frameworks, libraries, resources, and shiny things.
- Standard C++ - news, status and discussion about the C++ standard on all compilers and platforms.
- C++ Core Guidelines - Editors: Bjarne Stroustrup, Herb Sutter. This is a living document under continuous improvement. Had it been an open-source (code) project, this would have been release 0.8. Copying, use, modification, and creation of derivative works from this project is licensed under an MIT-style license.
- https://github.com/changkun/modern-cpp-tutorial/blob/master/book/en-us/toc.md - C++ 11/14/17/20 On The Fly
- https://github.com/federico-busato/Modern-CPP-Programming - open-access course is directed at those who are already familiar with C and object-oriented programming towards a proficiency level of C++ programming. The course covers the basics of C++ programming and moves on to advanced C++ semantics and concepts.
Varieties
- https://github.com/guidoschmidt/examples.cpp - C++ (C++11, C++14, C++17) examples of using std, concepts, data structures and patterns
Basics
- static members - declares members that are not bound to class instances. Outside a class definition, it has a different meaning: see storage duration.
Types
- https://github.com/rollbear/strong_type - An additive strong typedef library for C++14/17/20 using the Boost Software License 1.
- https://github.com/celtera/ahsohtoa - Structure-of-array synthesis in C++20
- https://github.com/Shmoopty/veque - Fast C++ container combining the best features of std::vector and std::deque
Memory
- https://github.com/plasma-umass/Mesh - A memory allocator that automatically reduces the memory footprint of C/C++ applications.
Analysis
- https://github.com/jaspergould/cpp-source-analysis - tools to analyze c/c++ source code
Libraries
Standard library
- https://en.wikipedia.org/wiki/Algorithm_(C++) - components that perform algorithmic operations on containers and other sequences.
The C++ standard provides some standard algorithms collected in the <algorithm> standard header. A handful of algorithms are also in the <numeric> header. All algorithms are in the std namespace.
- https://en.wikipedia.org/wiki/Functional_(C++) - refers to a header file that is part of the C++ Standard Library and provides a set of predefined class templates for function objects, including operations for arithmetic, comparisons, and logic. Instances of these class templates are C++ classes that define a function call operator, and the instances of these classes can be called as if they were functions.[1] It is possible to perform very sophisticated operations without writing a new function object, simply by combining predefined function objects and function object adaptors.
The class template std::function provided by C++11 is a general-purpose polymorphic function wrapper. Instances of std::function can store, copy, and invoke any callable target—functions, lambda expressions (expressions defining anonymous functions), bind expressions (instances of function adapters that transform functions to other functions of smaller arity by providing values for some of the arguments), or other function objects. The algorithms provided by the C++ Standard Library do not require function objects of more than two arguments. Function objects that return Boolean values are an important special case. A unary function whose return type is bool is called a predicate, and a binary function whose return type is bool is called a binary predicate.
to sort
- https://github.com/p-ranav/awesome-hpp - A curated list of awesome header-only C++ libraries
- https://gitlab.com/eidheim/tiny-process-library - A small platform independent library making it simple to create and stop new processes in C++, as well as writing to stdin and reading from stdout and stderr of a new process
- https://github.com/MaGetzUb/smol_libs - single header C-libraries for *maximum portability.
- Boost provides free peer-reviewed portable C++ source libraries.
- Inja - a template engine for modern C++, loosely inspired by jinja for python. It has an easy and yet powerful template syntax with all variables, loops, conditions, includes, callbacks, comments you need, nested and combined as you like. Inja uses the wonderful json library by nlohmann for data input and handling. Most importantly, inja needs only two header files, which is (nearly) as trivial as integration in C++ can get. Of course, everything is tested on all relevant compilers.
- https://github.com/CLIUtils/CLI11 - CLI11 is a command line parser for C++11 and beyond that provides a rich feature set with a simple and intuitive interface.
- https://github.com/qookei/conflict - C++17 command-line argument parser with no extra dependencies.
- https://github.com/mgood7123/TempFile - a C++ Cross-Platform temporary file library
- https://github.com/fr00b0/nod - Small, header only signals and slots C++11 library.
- https://github.com/calccrypto/uint128_t - C++ unsigned 128 bit integer type
- https://github.com/rcliftonharvey/rchundenormal - Class for scoped protection against denormal numbers in pure C++
- Eigen - a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms.
- https://github.com/Microsoft/vcpkg - VC++ Packaging Tool [21]
- https://github.com/xtensor-stack/xsimd - C++ wrappers for SIMD intrinsics and parallelized, optimized mathematical functions (SSE, AVX, AVX512, NEON, SVE))
- POCO C++ Libraries - powerful cross-platform C++ libraries for building network- and internet-based applications that run on desktop, server, mobile, IoT, and embedded systems.
- https://github.com/nlohmann/json - JSON for Modern C++
- https://github.com/LLNL/units - A run-time C++ library for working with units of measurement and conversions between them and with string representations of units and measurements
- https://github.com/voidah/archive - Simple, compact, endian-safe and header-only serialization/deserialization for C++
- https://github.com/felixguendling/cista - Cista is a simple, high-performance, zero-copy C++ serialization & reflection library.
- https://github.com/max0x7ba/atomic_queue - multiple-producer-multiple-consumer C++14 lockless queues based on std::atomic<>.
- https://github.com/snaewe/loki-lib - Loki is a C++ library of designs, containing flexible implementations of common design patterns and idioms.
- https://github.com/liavt/MACE - MACE stands for MACE is A C++ Engine, Modular Abstract Components Engine, Many Amazing Classes Everywhere, Many Acronyms Can Exist, or the medievel weapon. Choose whichever one you like best.
- https://github.com/arbitrary-precision/ap - Arbitrary Precision provides C++ integer types that behave as basic integer types. This library aims to be intuitive and versatile in usage, rather than fast.
- http://arma.sourceforge.net/ - C++ library for linear algebra & scientific computing
- https://www.cryptopp.com/wiki/Main_Page - C++ library for cryptographic schemes originally written by Wei Dai and includes ciphers, message authentication codes, one-way hash functions, public-key cryptosystems, key agreement schemes, and deflate compression.
using namespace std
After you write this instruction, if the compiler sees string it will know that you may be referring to std::string, and if it sees vector, it will know that you may be referring to std::vector. (Provided that you have included in your compilation unit the header files where they are defined, of course.)
If you don't write it, when the compiler sees string or vector it will not know what you are refering to. You will need to explicitly tell it std::string or std::vector, and if you don't, you will get a compile error. [22]
- https://github.com/lewissbaker/cppcoro - A library of C++ coroutine abstractions for the coroutines TS
- Hoard - a fast, scalable, and memory-efficient memory allocator that can speed up your applications. It’s much faster than built-in system allocators: as much as 2.5x faster than Linux, 3x faster than Windows, and 7x faster than Mac.
- Memory Pool System - a flexible and adaptable memory manager. Among its many advantages are an incremental garbage collector with very low pause times, and an extremely robust implementation. It's both open source and commercially licensed.
- Simple DirectMedia Layer - a cross-platform development library designed to provide low level access to audio, leopard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. It is used by video playback software, emulators, and popular games including Valve's award winning catalog and many Humble Bundle games.
- openBliSSART - a C++ framework and toolbox that provides "Blind Source Separation for Audio Recognition Tasks". Its areas of application include, but are not limited to, instrument separation (e.g. extraction of drum tracks from popular music), speech enhancement, and feature extraction. It features various source separation algorithms, with a strong focus on variants of Non-Negative Matrix Factorization (NMF).
- Cinder - a C++ library for programming with aesthetic intent - the sort of development often called creative coding. This includes domains like graphics, audio, video, and computational geometry. Cinder is cross-platform, with official support for OS X, Windows, iOS, and WinRT. Cinder is production-proven, powerful enough to be the primary tool for professionals, but still suitable for learning and experimentation. Cinder is released under the 2-Clause BSD License.
- https://github.com/samhocevar/portable-file-dialogs - Portable GUI dialogs library, C++11, single-header
- https://github.com/whitequark/unfork - unfork(2) is the inverse of fork(2). sort of.
- https://github.com/Tarik02/machineid - C++ library to get unique machine id.
- https://github.com/wjakob/nanobind - a small binding library that exposes C++ types in Python and vice versa. It is reminiscent of Boost.Python and pybind11 and uses near-identical syntax. In contrast to these existing tools, nanobind is more efficient: bindings compile in a shorter amount of time, produce smaller binaries, and have better runtime performance.
- https://github.com/ultimatepp/ultimatepp - a C++ cross-platform rapid application development framework focused on programmer's productivity. It includes a set of libraries (GUI, SQL, Network etc.), and integrated development environment (TheIDE).
openFrameworks
- openFrameworks is an open source C++ toolkit designed to assist the creative process by providing a simple and intuitive framework for experimentation. The code is written to be massively cross-compatible. Right now we support five operating systems (Windows, OSX, Linux, iOS, Android) and four IDEs (XCode, Code::Blocks, and Visual Studio and Eclipse). The API is designed to be minimal and easy to grasp. openFrameworks is distributed under the MIT License. The toolkit is designed to work as a general purpose glue, and wraps together several commonly used libraries, including:
- OpenGL, GLEW, GLUT, libtess2 and cairo for graphics
- rtAudio, PortAudio, OpenAL and Kiss FFT or FMOD for audio input, output and analysis
- FreeType for fonts
- FreeImage for image saving and loading
- Quicktime, GStreamer and videoInput for video playback and grabbing
- Poco for a variety of utilities
- OpenCV for computer vision
- Assimp for 3D model loading
Web
- https://github.com/emweb/wt - a C++ library for developing web applications. It consists of: libwt, a widget/rendering library libwthttp, an (async I/O) HTTP/WebSockets server libwtfcgi, a FastCGI connector library (Unix) libwtisapi, an ISAPI connector library (Windows) libwttest, a test connector environmentIt also contains a C++ ORM, which can be used in a web application (obviously), but can also be used on its own
Magnum
- Magnum Engine - Looking for an open-source library that gives you graphics abstraction and platform independence on major desktop, mobile and web platforms? Do you want it to have all the convenience utilities around yet stay small, powerful and not give up on flexibility? Here it is. And it’s free to use, even for commercial purposes.
Compiling
- gccfilter - a perl filter to colorize and simplify (or expand) gcc diagnostic messages. gccfilter is particularly aimed at g++ (i.e. dealinging with C++) messages which can contain lot of template-related errors or warnings difficult to sort out.
Debugging
See also Debugging
- C++ Insights - See your source code with the eyes of a compiler
Wrappers
- Executive Summary - an interface compiler that connects programs written in C and C++ with scripting languages such as Perl, Python, Ruby, and Tcl. It works by taking the declarations found in C/C++ header files and using them to generate the wrapper code that scripting languages need to access the underlying C/C++ code. In addition, SWIG provides a variety of customization features that let you tailor the wrapping process to suit your application.