C++ Logo

std-proposals

Advanced search

Re: [std-proposals] #pragma once safer alternative

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Mon, 24 Mar 2025 23:21:25 +0100
Or will we get:   // x.cpp // #include <mylibrary>     // mylibrary // #ifdef __cpp_modules   import mylibrary #include "mylibrary_imported.h"   #else   #include "mylibrary_nomodules.h"   #endif     -----Ursprüngliche Nachricht----- Von:Marcin Jaczewski <marcinjaczewski86_at_[hidden]> Gesendet:Mo 24.03.2025 23:16 Betreff:Re: [std-proposals] #pragma once safer alternative An:std-proposals_at_[hidden]; CC:Sebastian Wittmeier <wittmeier_at_[hidden]>; pon., 24 mar 2025 o 21:39 Sebastian Wittmeier via Std-Proposals <std-proposals_at_[hidden]> napisał(a): > > Hi Marcin, > > > > import your_library; > #include "your_library_imported.h" > #include "third_party/A.h" // #include "your_library/a_header.h" but got skipped > > > > Wouldn't it be good, if import automatically (and optionally) includes a header file specified by the library module? > > Or it would not work as #include is for the preprocessor, whereas import is not? > It probably should not work, only `import "your_library.h";` could in theory work but only when we have include guards. But I have some doubts if any one will implement this version of `import` any time soon.

Received on 2025-03-24 22:26:55