Skip to content
Search

C++

lastmod 2026-01-05created 2014-01-05412 edits

C/C++ Libraries (list)

POSIX C Libraries (list)

The C programming language is a programming language created by Ken Thompson and Dennis Ritchie between 1969 and 1973, while they were working at Bell Labs, for use with the newly developed Unix operating system. Ken Thompson adapted the BCPL language to his needs and named it the "B" language (after the B in Bell Labs, where the language was developed), and the C language was born from this B language. The underlying programs of the Unix system were all written in C, and the kernels of many operating systems were also made in C. C++, widely used today, is C developed into an object-oriented language. Various other modern languages also have their roots in C.

C++ is a programming language announced in 1983 by Bjarne Stroustrup of AT&T Bell Labs and developed since then. Most of the C language syntax can be used in it, and it can be thought of as an extension of the C language with object orientation added.

About C/C++

In C++, you can check the version in code by checking the __cplusplus macro. You can also use Boost:Config.

ANSI/ISO Standard C

In 1983, the American National Standards Institute (ANSI) convened a committee called X3J11 to establish a standard for the C language. After a very long period of discussion, the committee's report was ratified on December 14, 1989 under the name ANSX3.159-1989 and published in 1990. Most of its content was taken from the existing C language, and some was taken from C++ (mostly concerning function prototypes). It also included support for multinational character sets (including the controversial trigraph character sequences). The ANSI C standard also standardized the C run-time library. Later, the international standards body ISO replaced the American standard X3.159 with ISO/IEC 9899:1990, making it an international standard. Because this standard mostly corrected and supplemented the ANSI standard, it is commonly called 'ANSI/ISO 9899-1990' [1992].

In 1994, 'Technical Corrigendum 1 (TC1)' made about 40 corrections to the standard. Most of the corrections added supplementary explanations to parts that needed clarification. And 'Normative Addendum 1 (NA1)' added about 50 pages of new concepts, almost all of which are descriptions of functions related to internationalization. In 1995, TC2 added a few more corrections.

At the time of writing, a complete revision of the standard has just entered its final stage. The new standard is currently named "C9X", which indicates that it is expected to be completed by the end of 1999. (Many parts of this text have also been revised to reflect the new C9X.)

The original ANSI standard included a "Rationale" containing explanations of many of its decisions and discussions of minor issues. Some of these have already been included in this text. (The Rationale itself is not part of ANSI standard X3.159-1989; it is provided for informational purposes only and is not part of the ISO standard either. A new edition is being prepared for C9X.)

From the A language to the C language

The C in the C language carries some meaning. It is also related to the history of programming languages. It is commonly said that languages developed in the order A, B, C, and D.

A language
In the past, it meant ALGOL (ALGOL is short for Algorithm Language and was created for algorithm research and development).
Today, rather than referring to a specific programming language, the term is used to refer to structured programming languages.
B language
Ken Thompson created an operating system called Unix in assembly language on DEC's PDP-7. Later, to rewrite this operating system in a high-level language, he created a language called B based on Matin Richards' BCPL (Basic CPL, CPL = COmbined Programming Language).
This language had no data types, which led to the creation of the C language.
C language
A language made in 1972 by Dennis Ritchie, Ken Thompson's colleague, who looked at the B language Ken Thompson had made and added the concept of data types to it.
Later, as C was adopted over B as the implementation language of Unix, a Unix implemented in C was created the following year, 1973.

C++11

C++ 11 (also known as C++0x) is the latest version of the C++ programming language, approved by ISO on August 12, 2011. It had been called C++0x because it was expected to be released at some point in the 2000s, but it was only finalized as an international standard in 2011, so its name was ultimately settled as C++11.

C++11 added several things to the core language, extended the C++ standard library, and incorporated the library exceptions of the mathematical special functions from the C++ Technical Report 1 (TR1) libraries. C++11 was published as ISO/IEC 14882:2011.

For reference, the code for checking the version is as follows. 1

#if defined(_MSC_VER) && (_MSC_VER < 1800)
# error "This project needs atleast Visual Studio 2013"
#elif (__cplusplus <= 199711L)
# error "This project can only be compiled with a compiler that supports C++11"
#endif

C++14

C++14 is the informal name for the most recent revision of the C++ ISO/IEC standard, formally "International Standard ISO/IEC 14882:2014(E) Programming Language C++".

Working Draft, Standard for Programming Language C++
N3797.pdf
http://open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3797.pdf

C++17

C++17 (also called C++1z) is the informal name for the future revision of the C++ ISO/IEC standard. The specification for the C++17 revision is speculated to be finished in 2017.

C++20

  • All C++20 core language features with examples | Oleksandr Koval’s blog - Key features of C++20 - summarized with examples
  • Concepts
  • Modules
  • Coroutines
  • Three-way comparison
  • Lambda expressions
  • Constant expressions
  • Aggregates
  • Non-type template parameters
  • Structured bindings
  • Range-based for loop
  • Attributes : [[likely]] , [[unlikely]] , [[no_unique_address]] , [[nodiscard]]
  • Character encoding : char8_t
  • Sugar
  • constinit
  • Signed integers are two’s complement
  • VA_OPT for variadic macros
  • Explicitly defaulted functions with different exception specifications
  • Destroying operator delete
  • Conditionally explicit constructors
  • Feature-test macros
  • Known-to-unknown bound array conversions
  • Implicit move for more local objects and rvalue references
  • Conversion from T* to bool is narrowing
  • Deprecate some uses of volatile
  • Deprecate comma operator in subscripts

Table of C Programming Language

Table of C Programming Language

Compilers

Borland Turbo C, Clang, GCC, LCC, Pelles C, PCC, TCC, Visual C++ (C++/CLI, C++/CX), Watcom C/C++ compiler

Libraries

C standard library, glibc, dietlibc, uClibc, Newlib, EGLIBC, Bionic

Features

String, Syntax, Preprocessor, Variable types and declarations, Functions

Select descendants

C++, C#, D, Objective-C, Alef, Limbo, Go

C/C++ Curriculum

A personal C/C++ curriculum would probably be best organized around Programming Paradigms. (Or see Programming language)

#

Keyword

Paradigm

Representative languages

Description

1

compiler

-

ASM

Compilation order.

2

#define

-

-

Preprocessing (lazy evaluation; Lazy evaluation) applied.

3

int, float

-

-

Statically typed language.

4

if, while

Structured programming

Pascal

Elimination of GOTO statements; sequence, selection, and iteration statements

5

array

Array programming

Ada, BASIC, MATLAB

Why arrays are needed

6

function

-

-

How to write functions

7

pointer

-

-

How to use pointers

8

C language

Procedural programming

C

9

class

Object-oriented programming

Java

How to use classes

10

template

Generic programming
Template metaprogramming

C++

How to use templates

11

try

Exception handling

12

lambda

Functional programming

Haskell, Scala, Clojure

Lambda expressions

13

-

Aspect-oriented programming

AspectC++

Additional paradigm

Other

Programming paradigms worth referring to:

Category

C++0x & C++11

Programming Tip & Guide

Examples

Build tools

Package Management

  • Conan - software package manager for C and C++ developers
  • vcpkg (Microsoft; C++ Library Manager for Windows, Linux, and MacOS)

Build speed

Profile tools

C/C++ Example

Libraries

Logging

TUI

GUI

Single file

Animation

  • Ozz-animation: open source c++ 3d skeletal animation library and toolset.
  • Choreograph: A simple, modern C++ animation and timing library.

Network/http

lockfree

  • Awesome Lock-Free
  • The Top 32 Lock Free Open Source Projects
  • Mintomic - A Small, Portable Lock-Free API
  • LMAX Disruptor - High Performance Inter-Thread Messaging Library
  • Boost.Lockfree - Boost lock-free data structures.
  • ConcurrencyKit - Concurrency primitives.
  • Folly - Facebook Open-source Library (has good implementation of MPMC queue).
  • Junction - Concurrent data structures in C++.
  • MPMCQueue - A bounded multi-producer multi-consumer lock-free queue written in C++11.
  • SPSCQueue - A bounded single-producer single-consumer wait-free and lock-free queue written in C++11.
  • Seqlock - Implementation of Seqlock in C++.
  • Userspace RCU - liburcu is a userspace RCU (read-copy-update) library.
  • libcds - A C++ library of Concurrent Data Structures.
  • Lockless - Lockless Performance
  • liblfds - portable, license-free, lock-free data structure library written in C.
  • DKit - C++ Library of Atomic and Lockless Data Structures
  • Microsoft L4 HashTable - L4 (Lock-Free on Read) Hashtable is a C++ library that implements hash table with arbitray byte stream keys/values.
  • xenium - A C++ library providing various concurrent data structures and reclamation schemes.

Memory Allocator

Mathematical

Debugging

Database

Entity System

Graphic

Modeling

GIS

Vector graphic

Audio

  • RtAudio - A set of C++ classes that provide a common API for realtime audio input/output across Linux (native ALSA, JACK, PulseAudio and OSS), Macintosh OS X (CoreAudio and JACK), and Windows (DirectSound, ASIO, and WASAPI) operating systems.
  • PortAudio - PortAudio is a free, cross-platform, open-source, audio I/O library. It lets you write simple audio programs in 'C' or C++ that will compile and run on many platforms including Windows, Macintosh OS X, and Unix (OSS/ALSA). It is intended to promote the exchange of audio software between developers on different platforms. Many applications use PortAudio for Audio I/O.
  • Libnyquist - Cross platform C++11 library for decoding audio (mp3, wav, ogg, opus, flac, etc)
  • libsoundio - C library for cross-platform real-time audio input and output
  • mini_al - Single file audio playback and capture library
  • SoLoud - SoLoud is an easy to use, free, portable c/c++ audio engine for games.

Parallel computing

Coroutine

  • libdill: Structured Concurrency for C
  • libtask: a Coroutine Library for C and Unix

Asynchronous programming

  • Userver - Asynchronous framework for C++

Process manager

Software metric

Sequence alignment

Compiler

Software Updater

Performance

Bundling

Terminal game programming

String

Typing

Web Framework

  • Lavandula - Lightweight web framework based on the C language

Embedding language

ETC

  • safe_c.h - Giving C superpowers - a custom header file (safe_c.h)

Optimization

Averaging two unsigned ints without overflow

Adding them and dividing by 2 overflows: (a + b) / 2

If you know which of the two is larger, you can also add the difference between the two values to the smaller one and divide by 2
low + (high - low) / 2
The patent on an algorithm that works without knowing which one is larger expired in 2016
(a / 2) + (b / 2) + (a & b & 1)
SWAR - SIMD within a register
(a & b) + (a ^ b) / 2
If the compiler supports 64-bit, cast
((unsigned long long)a + b) / 2

Object-oriented design patterns in C

  • Object-oriented design patterns in C and kernel development | GeekNews
    • [Original] Object-oriented design patterns on OSHub
    • Object-oriented design patterns enable flexible system design by implementing polymorphism and modularity even in kernels written in C
    • Uses vtables (virtual function tables) to standardize the interfaces of devices and services, supporting a variety of behaviors through dynamic changes at runtime
    • Kernel services and the scheduler provide consistent interfaces such as start, stop, and restart through vtables, encapsulating implementation details
    • Combined with kernel modules, supports dynamic driver loading, so the system can be extended without recompiling
    • This approach offers flexibility and freedom to experiment, but complex syntax and the clutter of passing objects explicitly are drawbacks

FFmpeg also uses a similar design.

Samples

Reusable source code

cpp-sample-arg_parser.110921.zip
Win32, Blackhole
Class that parses the Command line string passed to the main function
cpp-sample-BBitmap.zip
Win32, Roadie
Implementation of a class that can read Bitmap files
cpp-sample-console-rectangle.130313.zip
Win32
Sample showing how to draw a rectangle in the Win32 Console
cpp-sample-DLog.zip
Win32, Roadie
Formatted output function for DbgView
cpp-sample-DrawText.zip
Win32, WinCE, Roadie
Implementation of a multiline (Multiline) string output method usable on WinCE
cpp-sample-FileDialog.121031.zip
Win32, MFC, Roadie
File selection dialog class usable in MFC
cpp-sample-hddkey.zip
Win32, KTX2
Class to refer to for Win32 API Socket Programming UDP/IP
cpp-sample-JpegMergeReader.zip
Win32, Roadie, libjpeg
Project that can merge and read Jpeg files using libjpeg
cpp-sample-Locker.zip
Win32, KTX2
Class version of Win32 API CRITICAL_SECTION
cpp-sample-lock-gnuc.121026.zip
Linux, Roadie, Android
Class version of CRITICAL_SECTION for GNUC
cpp-sample-MdbReader.zip
MFC, Roadie, DAO
Implementation of a class for accessing MS Access *.MDB files using DAO
cpp-sample-MdbReader-v2.zip
MFC, Roadie DAO
Implementation of a class for accessing MS Access *.MDB files using DAO. (version.2) Fixed a bug related to the record count
cpp-sample-SerialCommunication.zip
Win32, KTX2
Implementation of a class for serial port communication
cpp-sample-SimplexList.zip
Win32, Roadie
Implementation of a simple List class without STL, as a step before implementing a B+tree
cpp-sample-SqliteReader.zip
Win32, Roadie
Implementation of a class that makes sqlite easy to use
cpp-sample-String.zip
Win32, KTX2
Dependency-free String Template class
cpp-sample-thread-gnuc.121026.zip
Linux, Roadie, Android
Thread class for GNUC
cpp-sample-thread-win.121101.zip
Win32, Roadie
Thread class for Win32
cpp-sample-time-gnuc.130129.zip
Win32, MINGW, Linux
Prints the current time in microseconds
cpp-sample-Timer.zip
Win32, WinCE, Roadie
Implementation of a class for time

Terms

Forward declaration
Forward declarations are used to minimize header inclusion dependencies.
Function template vs Template function
A Function template is a template for functions; a Template function is a function generated from a template. The same applies to Class template and Template class.
Argument vs Parameter
Parameter and argument
Wikipedia (ko) Parameter (computer programming)
A Parameter is the name of a variable used when declaring a function, and an Argument is the value passed when calling the function.
  • Parameters and arguments are often used interchangeably, in which case their meaning is interpreted according to context. Strictly speaking, however, parameters are the variables listed in a function's definition, and arguments are the actual values passed when the function is called. To make this distinction clear, it is common to view a parameter as a variable and an argument as a value.
  • Parameters appear in the definition of a function, and arguments appear where the function is called. In a function definition such as f(x) = x*x, the variable 'x' is the parameter, and in a function call such as f(2), the value '2' is the function's argument.
  • Each parameter is an intrinsic characteristic included in the function definition. For example, (in most languages) a function that adds two input integers and computes their sum needs two integer parameters. In general, a function can have any number of parameters, or none at all. If a function has parameters, the list of definitions of each parameter is called the parameter list.
  • Arguments, on the other hand, are the values supplied when a function is called, and unlike parameters, which are part of the function definition and do not change, their values can change with each call. The list of arguments where the function is called is called the argument list.
Parameter pack
Refers to "..." in a Variadic Template.
Variadic arguments
Variadic arguments.
Race condition (Data race)
A state in which multiple processes try to access a shared resource at the same time.
Structured Exception Handling (SEH)
Structured exception handling technique used in Windows OS.

Conference

  • CppCon
  • C++ and Beyond
  • Meeting C++
  • The ACCU Conference
  • C++Now

Documentation

Collects reference documents related to C/C++.

ISO/IEC 14882:2011 Programming Language C++ - draft
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf (N3242.pdf)
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4606.pdf
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4618.pdf
ISO/IEC 144882 C/C++ Standard (1998)
Cpp_standards_by_the_international_standards_organization.pdf
The ISO/IEC 144882 C/C++ standard specification document, established in 1998. Recent compilers all compile C/C++ syntax based on this specification. It is a document that anyone studying C/C++ should read at least once.
ISO/IEC 9899 C Standard (1999)
Iso-c-fdis_(1999-04).pdf
The ISO/IEC 9899 C language standard specification document, established in 1999. As C++ syntax was organized after ANSI, C syntax was organized at the same time. For example, ANSI C allowed only /* */ for comments, but 9899 also allows // for comments.
C/C++ Pointer
C,Cpp_Pointer.pdf
A 128-page document summarizing the syntax of C++ and pointers. Starting from the basic concepts of pointers, it explains in detail the relationship between pointers and arrays, how functions are called, and the internal behavior of functions that take pointers as arguments.
The C Programming Language 2nd edition (Ritchie, Kernighan)
The_C_Programming_Language_(Ritchie,_Kernighan).pdf
The second edition of Kernighan and Ritchie's famous book, C Programming Language. It is the textbook most faithful to ANSI C, and a book anyone studying the C language should read at least once. The book's first example, hello world, is a very famous program.
The C++ Programming Language 3rd edition (Stroustrap)
The_C++Programming_Language_3rd_edition(Stroustrap).zip
A guide to C++ language syntax written by Stroustrup himself, the creator of the C++ language.
C++ Primer Plus, 6th edition (2011)
Prata_S._-_Cpp_Primer_Plus,6th_Edition(2011).pdf
Very faithful to the standard, and explains even minor details quite thoroughly. It is not a simple syntax introduction or a book that only roughly shows how to use things, but closer to a dictionary, so it may be difficult for beginners.
The GNU C Library Reference Manual
Database.sarang.net.7z
Numerical Recipes in C - The Art of Scientific Computing - 2nd edition
Numerical_Recipes_in_C_-The_Art_of_Scientific_Computing-_Second_Edition.pdf
A collection of C-language code for numerical computation functions.
C++ Concurrency in Action: Practical Multithreading
CplusplusConcurrencyInAction.pdf
A book on C++ concurrency control written by the developers of the Boost:Thread library.
CppConcurrencyInAction - Korean translation
  • CppConcurrencyInAction-wiki-880ec15.tar.gz
C Programming FAQs
Translated and revised by Seong-Kook Shin - May 28, 2018
http://cinsk.github.io/cfaqs/html/cfaqs-ko.html
Cinsk.github.io-cfaqs.tar.gz
C++ Core Guidelines
https://github.com/isocpp/CppCoreGuidelines
CppCoreGuidelines-63316bc.zip
jwvg0425/ModernCppStudy - WIKI - Modern C++ Study
https://github.com/jwvg0425/ModernCppStudy/wiki
Jwvg0425-ModernCppStudy.wiki.zip
More C++ Idioms
https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms
https://upload.wikimedia.org/wikipedia/commons/5/55/MoreCppIdioms.pdf
Wikibooks.org_-_MoreCppIdioms.pdf (2017-01-25)
42 answers on C++ coding (The Ultimate Question of Programming, Refactoring, and Everything)
The Ultimate Question of Programming, Refactoring, and Everything
The_Ultimate_Question_of_Programming,_Refactoring,and_Everything-_Intel_Software.pdf
C++ Annotations version 10.9.0
https://c-annotationskr.sourceforge.io/
C-annotationskr.sourceforge.io-190921.zip
Working Draft, Standard for Programming Language C++ (21 August 2010; revises N3092)
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3126.pdf
N3126.pdf
C Programming FAQ (Korean)
http://www.cinsk.org/cfaqs/
Cfaqs_ko.pdf
ISO/IEC 14882:2011 C++11
http://blog.naver.com/lykaonesis/130148401235
ISO-IEC-14882-2011.pdf
Yeolhyeol Gangui: Choi Ho-seong's C Programming - Memory and Debugging Never Betray You
https://cafe.naver.com/windev/7880
ISBN_9788965400172.pdf

See also

Favorite site

Guide

Online Tools

  • [Recommended] Compiler Explorer (godbolt) - Matches each line of code to its assembly and links them. Supports multiple languages.
  • Quick C++ Benchmark - Instantly compare C++ benchmarks online
  • C++ Insights - See how C++ code gets compiled.
  • [Recommended] LeetGPU - Only platform to write and run CUDA code. Without a GPU. For Free. (a site for running CUDA code online for free)

Awesome

C++11

C/C++ Parser

Programming guide/tutorial

Other issue

References


  1. Stackoverflow: How do I check for C++11 support? ↩

  2. What_are_the_new_features_in_Cpp17_-_Stack_Overflow.pdf ↩

  3. Rename STL:Container document. ↩

  4. Faster_Cpp_builds_–_Bits_n_Bites.pdf ↩

  5. Incompatibilties_Between_ISO_C_and_ISO_C++_(ko).pdf ↩

  6. Old ver: Cplusplus_com-old.zip ↩

  7. Cplusplus_com.zip ↩

  8. Soenlab_com.7z ↩

  9. HANB_Cpp_STL_Programming.pdf ↩

  10. Fffaraz-awesome-cpp-README.md-6f80a64.zip ↩

  11. https://github.com/sindresorhus/awesome ↩

  12. C++11_FAQ_ko.pdf ↩

  13. Cplusplus11_faq-Bjarne_Stroustup.pdf ↩

  14. Stdcxx.apache.org.zip ↩

  15. Writing_Efficient_C_and_C_Code_Optimization.pdf ↩

  16. Milkywaygalaxy.freeservers.com-cpp_programming_howto.zip ↩

  17. A_list_of_open_source_Cpp_libraries_-_cppreference.pdf ↩

  18. Korean: http://ko.cppreference.com/w/cpp/links/libs ↩

  19. Cpp_programming_tuned_to_improve_performance.pdf ↩

author Zer0 sitemap