The correct title of this article is #include guard. The omission of the # is due to technical restrictions.
This section may be too technical for most readers to understand. Please help improve it to make it understandable to non-experts, without removing the technical details.(September 2018) (Learn how and when to remove this message)
In the C and C++ programming languages, an #include guard, sometimes called a macro guard, header guard or file guard, is a particular construct used to avoid the problem of double inclusion when dealing with the include directive.
The C preprocessor processes directives of the form #include <file> in a source file by locating the associated file on disk and transcluding ("including") its contents into a copy of the source file known as the translation unit, replacing the include directive in the process. The files included in this regard are generally header files, which typically contain declarations of functions and classes or structs.
If an #include directive for a given file appears multiple times during compilation (i.e. because it appeared in multiple other headers), the file is processed again each time. However, if certain C or C++ language constructs are defined twice, the resulting translation unit is invalid. #include guards prevent this erroneous construct from arising by defining a preprocessor macro when a header is first included, and detecting its presence to skip the file's contents on subsequent inclusions.
The addition of #include guards to a header file is one way to make that file idempotent. Another construct to combat double inclusion is #pragma once, which is non-standard but nearly universally supported among C and C++ compilers.
C and C++ programming languages, an #includeguard, sometimes called a macro guard, header guard or file guard, is a particular construct used to avoid...
include directives to the original file. Another solution is to use includeguards. Since C++20, headers can also be imported as header units, that is...
a single compilation. Thus, #pragma once serves the same purpose as includeguards, but with several advantages, including less code, avoidance of name...
The point guard (PG), also called the one or the point, is one of the five positions in a regulation basketball game. A point guard has perhaps the most...
The United States Coast Guard (USCG) is the maritime security, search and rescue, and law enforcement service branch of the United States Armed Forces...
The shooting guard (SG), also known as the two, two guard or off guard, is one of the five traditional positions in a regulation basketball game. A shooting...
The Praetorian Guard (Latin: cohortes praetoriae) was an elite unit of the Imperial Roman army that served as personal bodyguards and intelligence agents...
second would include the Imperial Guards of the Russian and German Empires prior to 1917–18. Monarchs frequently modelled their royal guards upon those...
shooting guards currently in the WNBA include Diana Taurasi and Seimone Augustus. Examples of NBA shooting guards are given below. Throughout the evolution...
A guard of honour (Commonwealth English), honor guard (American English) or ceremonial guard, is a group of people, typically drawn from the military,...
The Islamic Revolutionary Guard Corps (IRGC; Persian: سپاه پاسداران انقلاب اسلامی Sepāh-e Pāsdārān-e Enqelâb-e Eslâmī, lit. 'Army of Guardians of the...
not include the vessels of the Islamic Revolutionary Guard Corps Navy. Iran portal List of equipment of the Navy of the Islamic Revolutionary Guard Corps...
guard dogs include breeds and landraces of the Ovtcharka type and other farm guard dogs such as the Boerboel. Some breeds who make excellent guards are...
The Uniforms of the United States Coast Guardinclude dress uniforms, daily service uniforms, working uniforms, and uniforms for special situations, which...
In military organizations, a colour guard (or color guard) is a detachment of soldiers assigned to the protection of regimental colours and the national...
A security guard (also known as a security inspector, security officer, factory guard, or protective agent) is a person employed by a government or private...
The Texas Army National Guard is a component of the United States Army, the United States National Guard and the Texas Military Forces (along with the...
typically lines up on the line of scrimmage, opposite one of the offensive guards; however, he may also line up opposite one of the offensive tackles. Defensive...
antibacterial and water wicking. Some variations include the following: Cropped rash guard: A rash guard that is similar to a crop top and is made specifically...
Coast Guardinclude maritime safety and search and rescue. The Irish Marine Search and Rescue Region (IMSRR) is the area over which the Coast Guard has...
A coast guard or coastguard is a maritime security organization of a particular country. The term embraces wide range of responsibilities in different...
as guard labor include: management, guards, military personnel, and prison officers. Samuel Bowles has expanded the notion of guard labor to include IT...
special paygrade above E-9. The SEA's responsibilities include advising the chief of the National Guard Bureau on all enlisted matters affecting training and...
Current forces include the Texas Army National Guard, Texas Air National Guard, and Texas State Guard of the Texas Militia. Former forces include the Texian...