Item 62. Include Guards
Production C++ applications tend to use a lot of header files, and many header files include other header files. Under these circumstances, it’s common for the same header file to be indirectly included more than once in a compilation, and it’s not uncommon in large, complex applications for the same header file to occur hundreds of times in the same compilation. Consider the simple case of a header file hdr2.h that includes another header file, hdr1.h, and a header file hdr3.h that also includes hdr1.h. If both hdr2.h and hdr3.h are included in the same source file, hdr1.h will be included twice. Typically, such multiple inclusions are undesirable and cause multiple definition errors.
For this reason, C++ header files ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access