C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Benchmarking Including The C++ Standard Library

From: Marcin Jaczewski <marcinjaczewski86_at_[hidden]>
Date: Sat, 23 May 2026 21:26:11 +0200
sob., 23 maj 2026 o 19:53 Jonathan Wakely <cxx_at_[hidden]> napisał(a):
>
>
>
> On Sat, 23 May 2026, 17:36 Marcin Jaczewski, <marcinjaczewski86_at_[hidden]> wrote:
>>
>> sob., 23 maj 2026 o 12:08 Jonathan Wakely via Std-Proposals
>> <std-proposals_at_[hidden]> napisał(a):
>> >
>> >
>> >
>> > On Sat, 23 May 2026 at 00:38, Adrian Johnston via Std-Proposals <std-proposals_at_[hidden]> wrote:
>> >>
>> >>
>> >> Personally, I would expect all the permutations of the standard library modules required to be provided by my compiler vender, e.g. Ubuntu.
>> >
>> >
>> > No, that is very explicitly NOT how modules are expected to be used or deployed. GCC provides the std.cc file and you are expected to produce a CMI for your own needs.
>> >
>> > Otherwise there would be a ton of CMIs that need to be installed for every -std and other options that affect it, and the compiler would need to know where to find them based on the command-line options.
>>
>> Could one module provide multiple versions of std lib?
>
>
> Without the __cplusplus macro there's no way to limit what the module exports to only the features that match the -std you're compelling with.
>

Yes, but this only problem for standard not compiler as it can add
custom attributes like:
```
void foo() [[gnu::visible("std++17")]];
void bar() [[gnu::visible("gnu++17")]];
```


>> A lot types could be binary compatible and do not need a lot of duplications.
>> Otherwise how would shared std dynamic lib work?
>
>
> The library contains all the symbols, but you can't create an executable that depends on a C++23 symbol (such as string::contains) if you compile your source code with -std=c++20, because the new features simply aren't declared in the header and so aren't usable.
>
> With a module that exports everything, you'd be able to use everything, even with -std=c++20.
>
>

Received on 2026-05-23 19:26:27