📃
Julianne's Knowledge Base
  • README
  • Home
    • Computer Science and Programming
      • Data Structures
        • Array
        • Binary Heap
        • Binary Tree
        • Deque
        • Dynamic Array
        • Graph
        • Hash Table
        • Linked List
        • Queue
        • Stack
      • Databases
        • Database Normalization
      • Networking
        • IP Protocol
        • Network Devices
        • OSI Model and TCP/IP
        • Ethernet LAN Switching
        • IPv4 Addressing
        • Sockets
      • Operating Systems
        • UNIX Operating Systems
          • Fundamentals
            • Virtualization
              • CPU Virtualization
              • Processes
            • Processes
          • xv6
      • Software Development
        • General Tips
        • My Goals as a Software Developer
        • Programming Languages
          • C
            • Memory Management in C
          • C++
            • I/O in C++
            • Iterators
            • Memory Management in C++
          • Javascript/TypeScript
            • Inheritance
            • React
            • Useful Libraries
          • Python
        • Tools
          • GDB
          • Git
    • Cooking
      • Diet and Nutrition
      • Recipes
    • Languages
      • Japanese
        • Grammar
        • Numbers and Counting
    • Productivity
      • Getting Things Done (GTD)
      • My GTD Trigger List
      • My Personal Knowledge Management System
      • Obsidian
        • Plugins
        • Using Obsidian
Powered by GitBook
On this page
  • General Tips
  • Links
  1. Home
  2. Computer Science and Programming
  3. Software Development
  4. Programming Languages

C++

PreviousMemory Management in CNextI/O in C++

Last updated 4 years ago

General Tips

  • Difference between constexpr and const

    • const prevents variables from being modified, constexpr tells the compiler that an expression results in a compile-time constant

    • Only values known at compile time can be assigned to constexpr

    • When applied to functions, const can only be used for non-static member functions

      • Guarentees the member function does not modify any non-static data members

    • constexpr can be used with member and non-member functions

      • Declares function fit for use in constant expressions

      • Arguments and return types must be literal types

Links

  • (book)

C++ Core Guidelines
Programming: Principles and Practice Using C++ (2nd Edition)
Stackoverflow - Difference Between 'constexpr' and 'const'