Use this tag for questions about code (to be) compiled with a C++ compiler. C++ is a general-purpose programming language. It was originally designed as an extension to C, and keeps a similar syntax, but is now a completely different language.
What is C++?
C++ is a statically-typed, free-form, (usually) compiled, multi-paradigm, intermediate-level general-purpose programming language; not to be confused with C or C++/CLI. It was developed in the early 1980s by Bjarne Stroustrup, initially as a set of extensions to the C programming language. Building on C, C++ improved type-safety and added support for automatic resource management, object-orientation, generic programming, and exception handling, among other features.
New to C++?
Whether you are new to programming or coming to C++ from another programming language, it is highly recommended to have a good book from which to learn the language. We keep a detailed list of books.
If you are looking for good compilers, GCC is the most commonly used compiler on Linux and other Unix-like platforms; Clang is the official compiler on Mac and FreeBSD; Microsoft Visual C++ is the most commonly used on Windows. The Intel compiler is also commonly used for its optimized numerical computations on Windows, Linux, and Mac.
Turbo-C++ 3.0 is from 1991, extremely outdated, and definitely not recommended. See the previous paragraph for free choices from this millennium.
Join us in chat, where we discuss C++, programming in general, and even other stuff when the sun goes down and boredom creeps in. Don't forget your sense of humor, but keep it civilized.
Online compilers
If you want to give C++ a spin, you can try one of the following online compiler services:
- Coliru (GCC, Clang)
- ideone.com (GCC, Clang)
- codepad (GCC)
- rextester (GCC, Clang, Visual C++)
- repl.it (GCC)
- ELLCC (Clang)
- CodingGround (GCC)
- C++Shell (GCC)
- Wandbox (GCC, Clang)
- Godbolt Explorer (GCC, Clang, ICC, Visual C++). Many versions of GCC/Clang for x86, and also for some non-x86 arches (arm, arm64, ppc, avr), as well as latest versions of Microsoft Visual C++. Includes nicely formatted assembler output, even optionally color-highlighting source and assembler lines to help find which source line maps to which assembler line.
Other External Resources
- ISO C++ website
- C++ Reference
- ISO's C++ Standards Committee's Papers
- C++ Core Guidelines
- cplusplus: reference, tutorials, and history
- Guru of the Week: article series on high-quality, exception-safe C++ code
- Revised Guru of the Week (for C++1y)
- SGI's Standard Template Library Programmer's Guide
- More C++ Idioms
Optimization resources for x86, including C++ intrinsics for vector instructions: See the x86 tag wiki for links
- Agner Fog's Optimization guide for C/C++