C++ Logo

sg15

Advanced search

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

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Wed, 20 Apr 2022 21:25:38 +0300
On Wed, 20 Apr 2022 at 21:10, Nicolai Josuttis via Ext
<ext_at_[hidden]> wrote:
> IMO a compiler should parse a C++ file while a build system should not have to do that.

*sigh*

Build systems have done that for ages. You don't have to specify the
header dependencies of your source files,
build systems glean that information out of your souce files automatically.

> I learned yesterday that the/one reason Microsoft has a problem with supporting no specific extensions and not specific command-line options is that they have options to inject headers into c++ source files (/FI and -include) and want to support that still for module units. They have to know when starting the compilation, whether it is a module to decide whether to inject the header file at the front or in the global module fragment.
>
> I don't know whether that approach is valid at all. But it seems to hinder Microsoft to come up with a simple clean solution for the problem (yes, Gaby, formally this is not a "problem", you do everything standard conforming).
>
> This problem can be solved and should be solve by the compiler. So I strongly recommend to do that.

Other compilers like GCC have a similar facility, spelled -include.
This is nowhere near a Microsoft-specific challenge, and there's
nothing new or shocking about it.

Received on 2022-04-20 18:25:50