I am wondering if/ what include guards on files like windows.h
, math.h
, iostream
, stdio
... etc.
Since I have those headers included multiple times in different files. Do those files already have guards built in or is there a definition defined?
I am just wondering what the standards are for that kind of thing.
The C++ standard requires that the headers be organized such that you can include any of them multiple times, directly or indirectly, without running into problems. It doesn't mandate how that result will be achieved, just that it shall be achieved.
17.6.2.2 Headers [using.headers]
¶2 A translation unit may include library headers in any order (Clause 2). Each may be included more than once, with no effect different from being included exactly once, except that the effect of including either
<cassert>
or<assert.h>
depends each time on the lexically current definition ofNDEBUG
.178178 This is the same as the Standard C library.
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