Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

"C++20 Modules — Complete Guide" by Šimon Tóth

39 views
Skip to first unread message

Lynn McGuire

unread,
Sep 13, 2021, 6:33:23 PM9/13/21
to
"C++20 Modules — Complete Guide" by Šimon Tóth
https://itnext.io/c-20-modules-complete-guide-ae741ddbae3d

"Compilers and build systems are slowly starting to support C++20
modules. Perfect time for you to read this guide and benefit from the
massive compilation speedups. This article reflects the state as of
September 2021."

Lynn

Tim Woodall

unread,
Sep 14, 2021, 3:50:20 AM9/14/21
to
On 2021-09-13, Lynn McGuire <lynnmc...@gmail.com> wrote:
> "C++20 Modules ??? Complete Guide" by ??imon T??th
> https://itnext.io/c-20-modules-complete-guide-ae741ddbae3d
>
> "Compilers and build systems are slowly starting to support C++20
> modules. Perfect time for you to read this guide and benefit from the
> massive compilation speedups. This article reflects the state as of
> September 2021."
>

Thanks for the link.

I have a couple of quick questions.

In the "module" example we have
#include <iostream>;

Is the semicolon required here? Subtle, hard to spot change if it is!


This statement:

Unexported symbols have private visibility, which is the opposite of
normal C++ behaviour, where only symbols within anonymous namespaces are
unexported.


Has the export of symbols in anonymous namespaces changed? One upon a
time symbols in the anonymous namespaces were exported, but with a
mangled name that couldn't be deduced elsewhere.


I like the "cleanness" of anonymous namespaces over static. But I've
seen places where the sheer volume of exported but unused by the linker
symbols causes problems, especially for tools that, for example, attempt
to check for circular dependencies being introduced.



Anand Hariharan

unread,
Sep 14, 2021, 10:22:58 AM9/14/21
to
On Tuesday, September 14, 2021 at 2:50:20 AM UTC-5, Tim Woodall wrote:
> On 2021-09-13, Lynn McGuire <lynnmc...@gmail.com> wrote:
> > "C++20 Modules ??? Complete Guide" by ??imon T??th
> > https://itnext.io/c-20-modules-complete-guide-ae741ddbae3d
> >
> > "Compilers and build systems are slowly starting to support C++20
> > modules. Perfect time for you to read this guide and benefit from the
> > massive compilation speedups. This article reflects the state as of
> > September 2021."
> >
> Thanks for the link.
>
> I have a couple of quick questions.
>
> In the "module" example we have
> #include <iostream>;
>
> Is the semicolon required here? Subtle, hard to spot change if it is!
>

The code in the page was

import <iostream>;

Code uses 'import' not 'include'; also the '#' is omitted. In other words, no preprocessor at play.

Keith Thompson

unread,
Sep 14, 2021, 12:55:54 PM9/14/21
to
And to answer the question, yes, the semicolon is required.

From the N4885 draft:

module-declaration :
export-keyword[opt] module-keyword module-name module-partition[opt] attribute-specifier-seq[opt] ;

module-name :
module-name-qualifier[opt] identifier

module-partition :
: module-name-qualifier[opt] identifier

module-name-qualifier :
identifier .
module-name-qualifier identifier .

("module-keyword" is "module". The "module", "import", and "export"
keywords are treated specially.)

--
Keith Thompson (The_Other_Keith) Keith.S.T...@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */
0 new messages