These latest changes come on top of other previously approved additions including C++ concepts, designated initializers, ranges, a revised memory model
Announcement
Collapse
No announcement yet.
Coroutines & Modules Added For C++20
Collapse
X
-
Originally posted by Ananace View PostFrom how I understand modules to work, it is left up to the compiler to pass the necessary information (AST etc) between modules where necessary, instead of being the job of the preprocessor - which just naively inlines the entire header and all its includes.
Skipping the preprocessor here speeds up compiling immensely as you no longer need to parse headers more than once between correctly built modules, but you still get full visibility into the definition, just as an AST or other compiler-friendly datastructure.
Comment
-
Originally posted by klapaucius View PostWhat is this exactly? I couldn't find or I missed any mention of it in Herb Sutter's post.
http://www.open-std.org/jtc1/sc22/wg...8/p0668r4.html
I do wonder how much ARM's improved energy efficiency vs. x86 derives from its looser memory consistency model.
I know GPUs benefit greatly from relaxed memory consistency, but it means you can't do things like instruction-level traps.Last edited by coder; 24 February 2019, 05:24 AM.
- Likes 3
Comment
-
Originally posted by klapaucius View Post
What is this exactly? I couldn't find or I missed any mention of it in Herb Sutter's post.
I would guess this is referenced, but I haven been through the report yet
- Likes 2
Comment
-
So now the culprit are the buildsystems to support modules.- build2 is already preparing for/supporting the std modules
- CMake supposedly will leverage from its Fortram support (https://gitlab.kitware.com/cmake/cmake/issues/18355)
- Meson is so far bus writing papers how impossible this is (https://github.com/mesonbuild/meson/issues/4314)
- Likes 1
Comment
-
Originally posted by discordian View PostHope they collectively get their s..tuff together in time, and we wont end up with some broken concept in '20.
We will have a large problem at work where some of our compilers will remain old for our legacy requirements, and some will be c++20 one day. It is going to seriously complicate the build system having to use modules for some projects and traditional headers/libs for another.
Originally posted by dwagner View PostI certainly do not like every programming paradigm that has made it into the C++ standard, but the great thing about C++ is that it does not force you to follow one particular paradigm
Last edited by kpedersen; 24 February 2019, 08:23 AM.
- Likes 5
Comment
-
For those wondering about the current C++20 state in the GCC compiler can see this status matrix as well as the Clang status.
They have a webpage:
Visual C++ Language Conformance
https://docs.microsoft.com/en-us/cpp...ge-conformance
- Likes 1
Comment
-
Originally posted by atomsymbolThe use cases are (class T):- Accessing a T's field directly
- Calling a function/method/constructor/destructor which uses the inline keyword and accesses a T's field
- Instantiating T on the stack - although after some though this still does not require the knowledge of T's fields, just the knowledge of T's size and alignment
- Static variables of type T - although after some though this still does not require the knowledge of T's fields, just the knowledge of T's size and alignment
For template classes, the use cases are still just 1 and 2.
Comment
-
Originally posted by Ananace View Post
From how I understand modules to work, it is left up to the compiler to pass the necessary information (AST etc) between modules where necessary, instead of being the job of the preprocessor - which just naively inlines the entire header and all its includes.
Skipping the preprocessor here speeds up compiling immensely as you no longer need to parse headers more than once between correctly built modules, but you still get full visibility into the definition, just as an AST or other compiler-friendly datastructure.
Comment
-
Originally posted by bountykiller View Post
In fact you will still need to declare the class/methods you want to export in a specific part of our code (I think they call it the module preambule). The compiler won't compute it for you. So this is still better that the #include model because you won't have the header files textually included in our files, but it won't save you from having the declaration and the implementation defined in different places. (Note that this is a reason why I'm not really excited about modules).
- Likes 1
Comment
Comment