C++ Logo


Advanced search

Re: [SG15] module source suffixes

From: Boris Kolpackov <boris_at_[hidden]>
Date: Thu, 29 Aug 2019 15:15:39 +0200
Nathan Sidwell via SG15 <sg15_at_[hidden]> writes:

> My understanding is that SG15 was moving to recommend a different file
> suffix for CMI-producing source files. I understood the rationale to be for
> tools.

The rationale was that it can be beneficial to know that a file is a
module interface unit from its name in various contexts (tools, humans,
etc), the same as we can do for headers. After all, nothing prevents
one calling their headers .cpp (it is C++, right) but nobody does that
so there is clearly a benefit in the distinction.

Also, keep in mind that if the interface unit uses the same extension
as the implementation, then if you want to have both, you will have to
mangle one of them, for example:

foo.hpp -> foo.cpp
foo.cpp -> foo-impl.cpp

Another thing that just occurred to me is installation: do we want
/usr/include/ full of .cpp files?

> We should hesitate in recommending a change from existing suffixes
> in that case.

I don't view this as changing something existing. Module interface
units did not exist until now. We are now deciding which extension
they should be using.

Received on 2019-08-29 08:17:49