这个问题试图收集社区维护的关于c编程语言的优质书籍清单,目标是各种技能水平.
C是一种复杂的编程语言,通过阅读在线教程很难在旅途中学习.综合性书籍通常是学习语言的最佳方式,找到一本好书是第一步.重要的是要避免写得不好的书籍,更重要的是要避免包含严重技术错误的书籍.
请建议编辑接受的答案,以添加高质量的书籍,具有近似的技能水平和每本书的简短描述/描述.(请注意,问题已被锁定,因此不会接受新的答案.列表中会保留一个答案)
随意讨论书籍选择,质量,标题,摘要,技能水平以及您认为错误的任何其他内容.C社区认为令人满意的书籍将列在名单上; 其余的将定期删除.
对于由C和C++用户协会(ACCU)进行评论的书籍,应该与书籍一起添加指向这些评论的链接.
也可以看看:
这个问题在Meta上作为2018年删除问题审计的一部分进行了讨论.
达成共识的目的是保持其未被删除和积极维护.
TC对这个问题的回答留下了一个有趣的评论:
TC说:
有"标题",还有"源文件"."标题"不需要是实际文件.
这是什么意思?
仔细阅读标准,我看到对"头文件"和"标题"的大量引用.但是,关于#include,我注意到该标准似乎引用了"标题"和"源文件 ".(C++ 11,§16.2)
A preprocessing directive of the form
# include < h-char-sequence> new-line
searches a sequence of implementation-defined places for a header identified uniquely
by the specified sequence between the < and > delimiters, and causes the replacement
of that directive by the entire contents of the header. How the places are specified
or the header identified is implementation-defined.
Run Code Online (Sandbox Code Playgroud)
和
A preprocessing directive of the form
# include " q-char-sequence" …Run Code Online (Sandbox Code Playgroud) 我遇到麻烦让预编译的头文件工作,所以我提出了以下最小工作示例.
这是头文件 foo.h
#include <iostream>
using namespace std;
void hello() {
cout << "Hello World" << endl;
}
Run Code Online (Sandbox Code Playgroud)
我编译它g++ -c foo.h给我一个编译头foo.gch.我希望当我编译包含的以下源文件时foo.h,它应该选择标题foo.h.gch,我很好.
// test.cpp
#include <cstdio> // Swap ordering later
#include "foo.h" // ------------------
int main() {
hello();
}
Run Code Online (Sandbox Code Playgroud)
但令人惊讶的是,这不是使用编译foo.h.gch,而是使用 foo.h.要验证您可以将其编译为g++ -H test.cpp
但是,如果我更改包含的头文件的顺序如下:
// test.cpp
#include "foo.h" // ------------------
#include <cstdio> // Ordering swapped
int main() {
hello();
}
Run Code Online (Sandbox Code Playgroud)
现在,如果我编译使用g++ -H test.cpp,它编译foo.h.gch,哇!
所以我想知道这是否是GCC中的错误,还是我们应该使用这样的预编译头文件?在任何一种情况下,我认为知道它是有用的..