Yesterday I wrote by mistake #include "iostream"
and I haven't realized it because the compiler didn't give an error. Later I realized and I was surprised.
I have tried with this small program :
// Fichero a.h
#ifndef A_H
#define A_H
#endif // A_H
// Fichero a.cpp
#include <iostream>
#include "a.h"
int main(void) {
std::cout << "Hola Mundo" << std::endl;
return 0;
}
Which works as expected.
It also works if I put the two includes with double quotes " "
, this has surprised me.
If I put the two includes with minor major < >
it gives me a compilation error, which is what I expect:
a.cpp:2:15: fatal error: ah: No such file or directory
I thought that :
#include < >
it is for system headers or libraries.#include " "
it is for programmer headers.
But clearly not because iostream can also be included with " "
.
Can I just include it all with " "
?
Or could it have some adverse effect doing everything with " "
? And if so, what criteria to use to decide whether each include is done with " "
or < >
?