C++脑力训练器
C++ is famous for getting all the default behaviors wrong and for sometimes making demons fly out of your nose. Through 25 puzzles, from the useful to the outright weird, we explore some of C++'s most interesting quirks. How does initialization actually work? Do temporaries even exist? Why is `+!!"" ` a valid expression in C++? As you work through each puzzle, you will peel off some of the layers of complexity of C++, getting a fundamental understanding of how the language works. This will help you write better code and recognize issues more easily while debugging.
Each puzzle in the book is a complete, seemingly simple C++ program, but can you figure out the output for each, or will the answers stump you? Most of the programs compile and have deterministic, though sometimes surprising, output. Some might, however, have undefined behavior, where anything can happen, including making demons fly out of your nose! Yet others might have unspecified behavior with output that is not completely deterministic; we just know nothing as bad as nasal demons will happen.
All puzzles are accompanied by detailed discussions, taking a look under the hood at what exactly is going on to help you understand more about C++'s unexpected behaviors, as well as fundamental concepts like initialization, overload resolution, and implicit conversions. For the non-deterministic cases, we'll explore some typical behaviors one can expect to see in practice, what causes them, and why they shouldn't be relied on.
After working through the book, you'll have tools and techniques to help you write better and safer code, and a better understanding of the fundamentals of the language, the background for some of C++'s apparent weirdness, and a better feel for identifying bugs and unsafe code in your own programs.
What You Need
The book assumes basic knowledge of C++. If you want to run the programs yourself, you can use either a local C++ compiler or the online compilers athttps://godbolt.org.
中文| 2024 | ISBN:9798888650981 | 140页| EPUB | 2.27 MB C++以错误处理所有默认行为以及有时让恶魔飞出你的鼻子而闻名。通过25个谜题,从有用到完全奇怪,我们探索了C++的一些最有趣的怪癖。初始化实际上是如何工作的?临时工真的存在吗?为什么是“+!!“` C++中的有效表达式?当你解决每个难题时,你会剥离C++的一些复杂性,从而对语言的工作原理有一个基本的了解。这将帮助您编写更好的代码,并在调试时更容易识别问题。 书中的每个谜题都是一个完整的、看似简单的C++程序,但你能算出每个谜题的输出吗,还是答案会让你感到困惑?大多数程序编译后都有确定性的输出,尽管有时令人惊讶。然而,有些人可能有未定义的行为,任何事情都可能发生,包括让恶魔从你的鼻子里飞出来!然而,其他人可能会有未指明的行为,其输出不是完全确定的;我们只知道不会发生像鼻恶魔那样糟糕的事情。 所有谜题都伴随着详细的讨论,深入了解到底发生了什么,以帮助您更多地了解C++的意外行为,以及初始化、重载解析和隐式转换等基本概念。对于非确定性情况,我们将探索一些在实践中可以看到的典型行为,导致这些行为的原因,以及为什么不应该依赖它们。 读完这本书后,你将拥有工具和技术来帮助你编写更好、更安全的代码,更好地理解语言的基本原理,了解C++一些明显怪异的背景,更好地识别自己程序中的错误和不安全代码。 您需要什么 本书假定读者具备C++的基本知识。如果你想自己运行程序,你可以使用本地C++编译器或在线编译器athttps://godbolt.org.本站不对文件进行储存,仅提供文件链接,请自行下载,本站不对文件内容负责,请自行判断文件是否安全,如发现文件有侵权行为,请联系管理员删除。
Flux - Jinwoo Chong
La montagna e il mio mondo
La ricchezza che il denaro non ti puo dare
Tabbner's Nursing Care: Theory and Practice, 7th Edition
Small Animal Surgery, 4th Edition
Musculoskeletal Examination and Assessment: A Handbook for Therapists, 5th Edition
Perioperative Nursing: An Introduction, 2nd Edition
La legge delle colline
Quattro re. Leonard, Hagler, Hearns, Duran e l'ultima grande era della boxe
Fra gli ultras. Viaggio nel tifo estremo