Skip to content

Latest commit

 

History

History
37 lines (30 loc) · 1.18 KB

C++.md

File metadata and controls

37 lines (30 loc) · 1.18 KB
title description published date tags editor dateCreated
C++
true
2023-01-31 16:06:21 UTC
markdown
2023-01-31 16:03:37 UTC

This page is about C++.

Tips

  1. inline in c++

    1. used with static in c++
    2. defined in header files
    3. default if the function is defined inner Class
    4. inline function can be defined several times
    5. if interface separation is adapted, both declaration and definition need the keyword
  2. always use expression without side effect in assert macro

  3. construct member variable in order they defined(-Wreorder)

  4. mutable and volatile

    1. mutable is related to const, a member of a class
    2. mutable field can be changed even in an object accessed through a const pointer or reference, or in a const object
    3. the compiler KNOWS when a mutable object changes.
    4. volatile is related to register
    5. compiler prevent volatile variable from being put into register
    6. volatile location is one that can be changed by code the compiler DOESN'T know(e.g. some kernel-level driver)
  5. CV(const-volatility) specifiers(http://en.cppreference.com/w/cpp/language/cv)

    1. const
    2. volatile
    3. mutable