C++ Logo

sg15

Advanced search

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

From: Nathan Sidwell <nathan_at_[hidden]>
Date: Thu, 14 Apr 2022 06:47:30 -0400
On 4/14/22 01:34, Gabriel Dos Reis via Ext wrote:
>> Module partitions don't have their own implementation units, so I don't see what this means either.
>
> Module partitions can be exported, or not exported. When they are not exported, they are essentially (for all practical purposes) implementation units - but they can be imported. There was an evolutionary desire (during the C++20 cycle) to leave the door open to formally allow the notion of module partition implementation units (just like there was a desire to be able to import a module partition from the outside of the boundary or a module).

I think that depends on ones interpretation of 'practical purposes',
because from my PoV, module implementation partitions are /not/ simply
implementation units, because as you say, they can be imported. That's
a significant feature, and at a compiler implementation level drives one
to emit a CMI for them, just as with module interface [maybe-partitions].

nathan

>
> -- Gaby
>
> -----Original Message-----
> From: Ext <ext-bounces_at_[hidden]> On Behalf Of Herring, Davis via Ext
> Sent: Wednesday, April 13, 2022 10:27 PM
> To: Ben Boeckel <ben.boeckel_at_[hidden]>
> Cc: Herring, Davis <herring_at_[hidden]>; WG21 Tooling Study Group SG15 <tooling_at_[hidden]>; ext_at_[hidden]
> Subject: Re: [isocpp-ext] Can we expect that all C++ source files can have the same suffix?
>
>> Need? No. Even with different suffixes, a scanner is still necessary
>> to know what order files need to be compiled in.
>
> There is the special case of non-partition module implementation units ("module A;"): there can't be any dependencies on or ordering among them, so they could be distinguished by an extension and all compiled last in an arbitrary order. (The same is true of non-modular files, so one would perhaps distinguish the other module units instead.)
>
>> You also need `-internalPartition` to be able to tell:
>>
>> ```c++
>> // Compile with `-internalPartition`
>> module X:part; // non-exported module partition
>>
>> int f();
>> ```
>>
>> apart from:
>>
>> ```c++
>> // Compile without `-internalPartition`
>> module X:part; // without the flag, this is now an implementation unit
>>
>> int f() { return 0; }
>> ```
>
> I'm not sure what distinction is being drawn here. Both of these are implementation units (no 'export': [module.unit]/2) and module partitions (/3). There's no restriction about declarations being definitions in any such context. What would '-interalPartition' indicate here?
>
>> There is no syntactic difference; it is purely metadata. AFAIK, this is
>> not supported with GCC (one just uses `module X;` in the implementation
>> unit regardless of the partition).
>
> Module partitions don't have their own implementation units, so I don't see what this means either.
>
> Davis
> _______________________________________________
> Ext mailing list
> Ext_at_[hidden]
> Subscription: https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.isocpp.org%2Fmailman%2Flistinfo.cgi%2Fext&amp;data=05%7C01%7Cgdr%40microsoft.com%7Cb93f7e9b9d954e9ea4ad08da1dd775f7%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637855108490803176%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=S0rQSjvXdKHx0QMXI2aqJsInWTcYbuYbRGact07AuZA%3D&amp;reserved=0
> Link to this post: https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.isocpp.org%2Fext%2F2022%2F04%2F19003.php&amp;data=05%7C01%7Cgdr%40microsoft.com%7Cb93f7e9b9d954e9ea4ad08da1dd775f7%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637855108490803176%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=GxbD7iUlKlw%2BvZSlrR29ZLgLA8maMB1I%2BChaRw%2FtfrU%3D&amp;reserved=0
> _______________________________________________
> Ext mailing list
> Ext_at_[hidden]
> Subscription: https://lists.isocpp.org/mailman/listinfo.cgi/ext
> Link to this post: http://lists.isocpp.org/ext/2022/04/19004.php
>


-- 
Nathan Sidwell

Received on 2022-04-14 10:47:34