C preprocessor: Difference between revisions

Content deleted Content added
Rescuing 1 sources and tagging 0 as dead.) #IABot (v2.0.9.5
No edit summary
Line 376:
</syntaxhighlight>
 
The Objective-C directive should not be confused with the C++ keyword <code>import</code>, which is used to import C++ [[Precompiled header#Modules (C++)|modules]] (since [[C++20]]), and is not a preprocessor directive.
 
=== Nullable ===
Line 482:
 
;Import
The include directive limits code structure since it only allows including the content of one file into another. More modern languages support a [[modular programming|module]] concept that has public symbols that other modules import {{endash}} instead of including file content. Many contend that resulting code has reduced boilerplate and is easier to maintain since there is only one file for a module; not both a header and a body. [[C++20]] adds [[Precompiled header#Modules (C++)|modules]], and an <code>import</code> statement that is not handled via preprocessing.<ref>{{cite web|url=https://isocpp.org/files/papers/n4720.pdf|title=N4720: Working Draft, Extensions to C++ for Modules|archive-date=2019-04-30|archive-url=https://web.archive.org/web/20190430095053/https://isocpp.org/files/papers/n4720.pdf|url-status=live}}</ref><ref>{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1857r1.html|title=P1857R1 – Modules Dependency Discovery}}
</ref> Modules in C++ compile faster and link faster than traditional headers,<ref>{{cite web|url=https://learn.microsoft.com/en-us/cpp/build/compare-inclusion-methods?view=msvc-170|title=Overview of modules in C++|date=12 February 2022 |publisher=Microsoft}}</ref> and eliminate the necessity of [[include guard|{{mono|#include}} guards]] or [[pragma once|{{mono|#pragma once}}]]. Until C++26, <code>import</code>, <code>export</code>, and <code>module</code> keywords were partially handled by the preprocessor.