C++核心准则原文翻译

296 篇文章
31 人订阅

全部文章

面向对象思考

C++核心准则CP.32:使用shared_ptr在无关线程之间共享所有权

If threads are unrelated (that is, not known to be in the same scope or one with...

6920
面向对象思考

C++核心准则CP.31:在线程之间以传值方式传递少量数据,而不是传递引用或指针

Copying a small amount of data is cheaper to copy and access than to share it us...

7610
面向对象思考

C++核心准则CP.26:不要分离线程

Often, the need to outlive the scope of its creation is inherent in the threads ...

6720
面向对象思考

C++核心准则CP.22:永远不要拿着锁调用未知代码

CP.22: Never call unknown code while holding a lock (e.g., a callback)

4810
面向对象思考

C++核心准则CP.23:将连结线程看作范围化的容器

CP.23: Think of a joining thread as a scoped container

7930
面向对象思考

C++核心准则CP.24:将线程看作全局​容器

CP.24: Think of a thread as a global container

7420
面向对象思考

C++核心准则:gsl::joining_thread好于std::thread

A joining_thread is a thread that joins at the end of its scope. Detached thread...

8230
面向对象思考

C++核心准则CP.21:使用std::lock()或者std::scoped_lock获取多个mutex

Here, the writers of thread1 and thread2 are still not agreeing on the order of ...

7520
面向对象思考

C++核心准则CP.8:不要使用volatile关键字实现同步处理​

CP.8: Don't try to use volatile for synchronization

7720
面向对象思考

C++核心准则CP.4:按照任务思考问题,而不是线程

CP.4: Think in terms of tasks, rather than threads

5910
面向对象思考

C++核心准则CP.3:尽量不要显式共享可写数据

CP.3: Minimize explicit sharing of writable data

8120
面向对象思考

C++核心准则CP.9:尽可能使用工具检查并发代码

CP.9: Whenever feasible use tools to validate your concurrent code

5610
面向对象思考

C++核心准则CP.20:使用RAII,永远不要直接使用lock/unlock

Avoids nasty errors from unreleased locks.

5310
面向对象思考

C++核心准则CP.2:避免数据竞争​

Unless you do, nothing is guaranteed to work and subtle errors will persist.

5620
面向对象思考

C++核心准则CP.1: 设想你的代码​会成为多线程程序的一部分

It's hard to be certain that concurrency isn't used now or won't be used sometim...

6210
面向对象思考

C++核心准则Per.19:以可以预测的方式访问内存

Performance is very sensitive to cache performance and cache algorithms favor si...

5910
面向对象思考

C++核心准则Per.11:将计算从运行时移动到编译时

To decrease code size and run time. To avoid data races by using constants. To c...

8340
面向对象思考

C++核心准则Per.7:设计要为优化做准备

Because we often need to optimize the initial design. Because a design that igno...

6430
面向对象思考

C++核心准则Per.5,6 关于性能的误解

Low-level code sometimes inhibits optimizations. Optimizers sometimes do marvels...

10320
面向对象思考

C++核心准则Per.1,2,3,4 慎重地优化代码

If there is no need for optimization, the main result of the effort will be more...

4210

扫码关注云+社区

领取腾讯云代金券