首页
学习
活动
专区
工具
TVP
发布

C++核心准则原文翻译

专栏作者
465
文章
260037
阅读量
44
订阅数
自学鸿蒙应用开发(25)- 基本的CommonDialog
对话框是应用程序的主要输入手段之一,但是遗憾的是目前鸿蒙的开发网站上只有ToastDialog用法,其他类型的对话框则只能参考为数不多的英文文档。
面向对象思考
2021-02-25
6590
C++核心准则​讨论:持有没有被句柄管理的资源时切勿抛出异常
Discussion: Never throw while holding a resource not owned by a handle
面向对象思考
2020-12-31
6340
C++核心准则​讨论:析构,释放和交换操作必须永不失败
Never allow an error to be reported from a destructor, a resource deallocation function (e.g., operator delete), or a swap function using throw. It is nearly impossible to write useful code if these operations can fail, and even if something does go wrong it nearly never makes any sense to retry. Specifically, types whose destructors might throw an exception are flatly forbidden from use with the C++ Standard Library. Most destructors are now implicitly noexcept by default.
面向对象思考
2020-12-15
6180
C++核心准则​NL.19:避免容易被误读的名称
Readability. Not everyone has screens and printers that make it easy to distinguish all characters. We easily confuse similarly spelled and slightly misspelled words.
面向对象思考
2020-12-15
4230
C++核心准则​NL.18:使用C ++风格的声明符布局
The C-style layout emphasizes use in expressions and grammar, whereas the C++-style emphasizes types. The use in expressions argument doesn't hold for references.
面向对象思考
2020-12-15
3990
C++核心准则​NL.17:使用K&R风格派生的布局
This is the original C and C++ layout. It preserves vertical space well. It distinguishes different language constructs (such as functions and classes) well.
面向对象思考
2020-12-15
6150
C++核心准则​NL.10:首选下划线风格名称
The use of underscores to separate parts of a name is the original C and C++ style and used in the C++ Standard Library.
面向对象思考
2020-11-26
3830
C++核心准则​GSL:指南支持库
The GSL is a small library of facilities designed to support this set of guidelines. Without these facilities, the guidelines would have to be far more restrictive on language details.
面向对象思考
2020-11-17
8430
C++核心准则​Pro.lifetime:生命周期安全群组
Accessing through a pointer that doesn't point to anything is a major source of errors, and very hard to avoid in many traditional C or C++ styles of programming. For example, a pointer might be uninitialized, the nullptr, point beyond the range of an array, or to a deleted object.
面向对象思考
2020-11-11
4080
C++核心准则​Pro.safety:类型安全准则群组
This profile makes it easier to construct code that uses types correctly and avoids inadvertent type punning. It does so by focusing on removing the primary sources of type violations, including unsafe uses of casts and unions.
面向对象思考
2020-11-10
5520
C++核心准则​SL.io.10:不使用printf函数群时应该调用sync_with_stdio(false)
Synchronizing iostreams with printf-style I/O can be costly. cin and cout are by default synchronized with printf.
面向对象思考
2020-10-30
4270
C++核心准则​SL.io.3:优先使用iostream进行I / O
iostreams are safe, flexible, and extensible.
面向对象思考
2020-10-30
8320
关于C++异常,你必须知道的
本文是作者翻译过C++之父Bjarne Stroustrup的技术文章C++核心准则中有关C++中异常的文章之后的总结,希望读者通过本文可以对C++异常有一个全面,快速的了解:
面向对象思考
2020-10-30
5530
C++核心准则​SL.str.3:使用zstring或czstring引用C风格0结尾的字符串序列
Readability. Statement of intent. A plain char* can be a pointer to a single character, a pointer to an array of characters, a pointer to a C-style (zero-terminated) string, or even to a small integer. Distinguishing these alternatives prevents misunderstandings and bugs.
面向对象思考
2020-10-30
6680
C++核心准则​​SL.str.2:使用std::string_view或者gsl::span<char>参照字符序列
SL.str.2:使用std::string_view或gsl::span<char>参照字符序列
面向对象思考
2020-10-30
8190
C++核心准则​​SL.str.1:使用std::string管理字符序列
string correctly handles allocation, ownership, copying, gradual expansion, and offers a variety of useful operations.
面向对象思考
2020-10-30
4480
C++核心准则SL.con.4:不要对不能直接拷贝的参数使用memset或memcpy
Doing so messes the semantics of the objects (e.g., by overwriting a vptr).
面向对象思考
2020-10-30
5880
C++核心准则SL.con.3:避免越界错误
Read or write beyond an allocated range of elements typically leads to bad errors, wrong results, crashes, and security violations.
面向对象思考
2020-10-30
5890
C++核心准则​SL.con.1:标准库array或vector好于C数组
C arrays are less safe, and have no advantages over array and vector. For a fixed-length array, use std::array, which does not degenerate to a pointer when passed to a function and does know its size. Also, like a built-in array, a stack-allocated std::array keeps its elements on the stack. For a variable-length array, use std::vector, which additionally can change its size and handles memory allocation.
面向对象思考
2020-10-30
5500
C++核心准则:积极、正确地使用标准库
Save time. Don't re-invent the wheel. Don't replicate the work of others. Benefit from other people's work when they make improvements. Help other people when you make improvements.
面向对象思考
2020-10-30
2970
点击加载更多
社区活动
Python精品学习库
代码在线跑,知识轻松学
【玩转EdgeOne】征文进行中
限时免费体验,发文即有奖~
博客搬家 | 分享价值百万资源包
自行/邀约他人一键搬运博客,速成社区影响力并领取好礼
技术创作特训营·精选知识专栏
往期视频·干货材料·成员作品·最新动态
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档