Skip to content

Latest commit

 

History

History
29 lines (28 loc) · 1.56 KB

C++ Tricks, Tips, and Tidbits.md

File metadata and controls

29 lines (28 loc) · 1.56 KB

Here is a list of "did you know..." or "tip of the day" statements about C++. They are intended to be informative and thought provoking without being very verbose.

  • C++ first appeared in 1985
  • C++ was first standardized in 1998
  • A new version of C++ is released every 3 years since 2011
  • C++14 can be considered a bugfix to C++11
  • Lambdas are new types created for you by the compiler
  • Only ::, ., and .* operators cannot be overloaded
  • C++ is an ISO standard
  • auto follows the same rules as template parameters
  • [[nodiscard]] makes it a warning to ignore a return value
  • [[nodiscard]] can be applied to both functions and types
  • static_assert performs a compile-time check
  • There are 3 main currently maintained C++ compiler implementations
  • constexpr functions may be evaluated at compile-time
  • constexpr values are evaluated at compile-time
  • consteval functions must be evaluated at compile-time
  • -Wall in GCC and Clang does not enable ALL warnings
  • /Wall in MSVC DOES enable ALL warnings
  • C++ has stricly defined object lifetime rules
  • if constexpr allows for compile-time branching
  • std::format provides python-like string formatting for C++
  • C++23 added 2 new floating point types!
  • In C++20, virtual functions can be constexpr
  • enum struct and enum class are equivalent
  • Unions can have constructors and member methods
  • You can use unary operator+ to cast a stateless lambda to a function pointer
  • C++ got its OOP features from Simula67 Programming language.
  • The override keyword was added to the language in C++11.