Declare by including its title rather than an explicit declaration

What does this advice mean? This is from the C ++ programming language, Special Edition.

Declare standard library objects, including its title, and not an explicit declaration; §16.1.2.

Here is an excerpt from § 16.1.2, which, in my opinion, matters:

For the standard library, the object to be used must be included. Drafting the relevant declarations themselves are not a standardized alternative. the reason is that some implementations optimize compilation based on standard inclusion headers and other optimized implementations of standard libraries called headers. In general, developers use standard headers in ways programming cannot predict and should not know.

+3
source share
2 answers

It means that:

#include <cstdio>

Not this:

int printf(const char * format, ...);

You will often find that people suggesting that executing the latter will lead to faster compilation times (since the compiler does not have to read and interpret all the standard header files).

+9
source

It just means that you are #includestandard C ++ libraries, not any other alternative methods. It simply defines the standard to be followed. To use it, there must be a protocol.

+1
source

All Articles