C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Freestanding std modules

From: Marcin Jaczewski <marcinjaczewski86_at_[hidden]>
Date: Tue, 2 Jul 2024 17:52:18 +0200
wt., 2 lip 2024 o 17:48 Thiago Macieira via Std-Proposals
<std-proposals_at_[hidden]> napisaƂ(a):
>
> On Tuesday 2 July 2024 07:48:28 CEST pifminns deettnta via Std-Proposals
> wrote:
> > #include<iostream>
> >
> > int main()
> > {
> > }
>
> FYI for the sensible people on this thread:
>
> libstdc++ emits something via inline assembly with the above so that std::cin,
> cout and cerr are properly initialised, just with the #include. I believe this
> was necessary back in 2003 when the current version of libstdc++ was designed
> or no one cleaned up at that opportunity. With the binary compatibility
> requirements, it must continue doing that.
>
> This violates "don't pay for what you don't need" and could be considered a
> flaw in the current libstdc++ design. But it's not a bug and is not required by
> the Standard, as evidenced by the fact that neither libc++ nor MS STL have
> such shortcoming.
>
> It's also easy to work around: #include a more precise header, like fstream,
> strstream, ostream, etc.
>

And this will not be needed when I use `import std;` in future version of GCC?

> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Principal Engineer - Intel DCAI Platform & System Engineering
>
>
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2024-07-02 15:52:31