New to C++! So I was reading this: http://www.learncpp.com/cpp-tutorial/110-a-first-look-at-the-preprocessor/
Header guards
Because header files can include other header files, it is possible to end up in the situation where a header file gets included multiple times.
So we make preprocessor directives to avoid this. But I'm not sure - why can't the compiler just... not import the same thing twice?
Given that header guards are optional (but apparently a good practice), it almost makes me think that there are scenarios when you do want to import something twice. Although I can't think of any such scenario at all. Any ideas?
#pragma once
which tells the compiler to only include that file once. – CodesInChaos Mar 29 at 11:03