Articles
-
Include Guards and their Optimizations
This article discusses the purpose and importance of include guards in C/C++ projects. It also explores the optimizations that compilers have surrounding include guards to improve build times, and the how easy it is to unintentionally disable these optimizations! Read more...
-
#pragma once
vs#ifndef
Include guards are a core part of C/C++ programming. There are two idiomatic methods to prevent a file from being included multiple times within the same translation unit:
#pragma once
and a guard macro using#ifndef
. This article will dissect these two methods, highlighting their differences and equipping you with the necessary knowledge to select the most suitable include guard for your project. Read more...