我只是好奇,因为在我的家庭作业中它说以下陈述是假:
The C++ Standard Library functions and classes are not included in every C++ implementation.
我不认为标准库包含在每个 C++ 实现中,除非您添加 (#include
) 适当的 header ,对吗?既然如此,我认为上述说法是正确的,而不是错误的。
这句话是真还是假?
最佳答案
不幸的是,“include”一词重载了。
您的 C++ 编译器附带包含标准库的文件。所以他们被“包括”了。但它们不是 #include
-d,您必须在源文件中编写 #include
才能访问标准库。
此外,还有托管 和独立 实现。标准是这样说的:
Two kinds of implementations are defined: a hosted implementation and a freestanding implementation. For a hosted implementation, this International Standard defines the set of available libraries. A freestanding implementation is one in which execution may take place without the benefit of an operating system, and has an implementation-defined set of libraries that includes certain language-support libraries (17.6.1.3).
由于该声明说“每个 C++ 实现”,并且独立实现不包括整个 C++ 标准库,因此该声明是正确的。
关于c++ - C++ 标准库函数和类是否包含在每个 C++ 实现中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8956160/