C++核心準(zhǔn)則?Pro.lifetime:生命周期安全群組

Pro.lifetime: Lifetime safety profile
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.
通過(guò)沒(méi)有指向任何內(nèi)容的指針進(jìn)行訪問(wèn)是錯(cuò)誤的主要來(lái)源之一,這在許多傳統(tǒng)的C或C ++編程風(fēng)格中很難避免。例如,指針可能未初始化,空指針,指向數(shù)組范圍之外或指向已刪除的對(duì)象的指針。
See the current design specification here.
請(qǐng)參閱下面的最新設(shè)計(jì)規(guī)范。
https://github.com/isocpp/CppCoreGuidelines/blob/master/docs/Lifetime.pdf
Lifetime safety profile summary(聲明周期安全群組摘要):
Lifetime.1: Don't dereference a possibly invalid pointer:?detect or avoid.
Lifetime.1:不要取消引用可能無(wú)效的指針:檢測(cè)或避免。
Impact(影響)
Once completely enforced through a combination of style rules, static analysis, and library support, this profile
通過(guò)結(jié)合樣式規(guī)則,靜態(tài)分析和庫(kù)支持徹底實(shí)施后,此規(guī)則群組
eliminates one of the major sources of nasty errors in C++
消除了C ++中令人討厭的錯(cuò)誤的主要來(lái)源之一
eliminates a major source of potential security violations
消除了潛在的安全違反的主要根源
improves performance by eliminating redundant "paranoia" checks
通過(guò)消除多余的“偏執(zhí)”檢查來(lái)提高性能
increases confidence in correctness of code
增加對(duì)代碼正確性的信心
avoids undefined behavior by enforcing a key C++ language rule
通過(guò)執(zhí)行關(guān)鍵的C ++語(yǔ)言規(guī)則避免未定義的行為
原文鏈接
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#prolifetime-lifetime-safety-profile
新書(shū)介紹
《實(shí)戰(zhàn)Python設(shè)計(jì)模式》是作者最近出版的新書(shū),拜托多多關(guān)注!

本書(shū)利用Python 的標(biāo)準(zhǔn)GUI 工具包tkinter,通過(guò)可執(zhí)行的示例對(duì)23 個(gè)設(shè)計(jì)模式逐個(gè)進(jìn)行說(shuō)明。這樣一方面可以使讀者了解真實(shí)的軟件開(kāi)發(fā)工作中每個(gè)設(shè)計(jì)模式的運(yùn)用場(chǎng)景和想要解決的問(wèn)題;另一方面通過(guò)對(duì)這些問(wèn)題的解決過(guò)程進(jìn)行說(shuō)明,讓讀者明白在編寫(xiě)代碼時(shí)如何判斷使用設(shè)計(jì)模式的利弊,并合理運(yùn)用設(shè)計(jì)模式。
對(duì)設(shè)計(jì)模式感興趣而且希望隨學(xué)隨用的讀者通過(guò)本書(shū)可以快速跨越從理解到運(yùn)用的門(mén)檻;希望學(xué)習(xí)Python GUI 編程的讀者可以將本書(shū)中的示例作為設(shè)計(jì)和開(kāi)發(fā)的參考;使用Python 語(yǔ)言進(jìn)行圖像分析、數(shù)據(jù)處理工作的讀者可以直接以本書(shū)中的示例為基礎(chǔ),迅速構(gòu)建自己的系統(tǒng)架構(gòu)。
覺(jué)得本文有幫助?請(qǐng)分享給更多人。
關(guān)注微信公眾號(hào)【面向?qū)ο笏伎肌枯p松學(xué)習(xí)每一天!
面向?qū)ο箝_(kāi)發(fā),面向?qū)ο笏伎迹?/span>
