Accelerated C++: Practical Programming by Example book says the following..
... system header files need not be implemented as files. Even though the #include directive is used to access both our own header files and system headers, there is no requirement that they be implemented in the same way
What exactly does this mean? If not as a file how else can a system header file be implemented?
Imagine you write your own compiler and C++ standard library. You could make it so that #include <vector>
does not open any file, but instead simply loads some state into the compiler which makes it understand std::vector
. You could then implement your vector class in some language other than C++, so long as your compiler understands enough to make it work "as if" you had written an actual C++ source file called vector
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With