rangersly cf4b2cb324 FIX: merge gcc_g++ create shared lib
FIX: C in linux  read  KEY
    FIX: .bashrc  echo  DIR
    FIX: gcc_g++ create shared lib
2025-05-09 18:07:44 +08:00

30 lines
739 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# c-cpp function
## 目录
- [extern](#extern)
- [noexcept](#noexcept)
- [重载](#)
## extern
`exterm` 表明函数在外部定义,在链接期才去查找
`extern "C"` 表明以C的方式查找外部函数
## noexcept
```cpp
void myFunction() noexcept {
// 这个函数不会抛出异常
}
```
noexcept 的一个重要用途是优化性能,特别是在移动语义中。当一个函数被标记为 noexcept 时,编译器可以更积极地优化代码
## 重载
只要特征标不同就可以重载
**特征标**:原型除去返回值都是
+ 左值优先选择T&如果不可用则选择const T&
+ const左值选择const T&
+ 右值优先选择T&&, else const T&
+ 字面量或临时对象选择T&&