C++ Logo

sg15

Advanced search

Re: [isocpp-ext] Can we expect that all C++ source files can have the same suffix?

From: Peter Dimov <pdimov_at_[hidden]>
Date: Wed, 20 Apr 2022 19:49:10 +0300
Ben Boeckel wrote:
> On Wed, Apr 20, 2022 at 08:49:18 -0500, René Ferdinand Rivera Morell via
> Ext wrote:
> > On Wed, Apr 20, 2022 at 8:22 AM Daniel Ruoso via SG15
> > <sg15_at_[hidden]>
> > wrote:
> > > Why do we need to coerce compilers into playing this role?
> >
> > Because build systems are not part of the ISO standards from WG21.
> > While we can't describe a build ecosystem in an ISO standard, C++ will
> > need to be usable without the existence of anything except the "compiler".
>
> Well, if we're getting technical, ISO C++ doesn't have compilers either (at least
> "compile" is nowhere in `[intro.defs]`). There *are* implementations. How
> they exist or work is not something I've seen in the C++ standard.
>
> And even given what I think you're referring to as a "compiler", I have no idea
> what to do with such a thing without a standard library, linker, or backing
> platform implementation (because no C++ stdlib I'm aware of implements
> `std::filesystem` without an underlying platform).

That's true in principle, but all these things are in practice part of the shipped
implementation, whereas a standard build system is not.

Having `import <iostream>;` Just Work is not really any different from having

    c++ a.cpp b.cpp

Just Work, even though this involves compiling these two translation units
into temporary object files, with the compiler automatically knowing where
to find the standard headers, then linking the result into an executable,
with the linker automatically knowing that it needs to link the C++ standard
library, or where to find it.

In either case, the "proper way" to make things is with a Build System.
 

Received on 2022-04-20 16:49:16