Author Topic: Support for c++20 modules  (Read 256 times)

Offline sm0ke

  • Single posting newcomer
  • *
  • Posts: 2
Support for c++20 modules
« on: April 16, 2021, 11:40:29 pm »
Hello, i like this IDE. But it's not allow to use modules in cpp.
Does the modules will be available by code::blocks in near future?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13202
    • Travis build status
Re: Support for c++20 modules
« Reply #1 on: April 17, 2021, 01:00:26 am »
Probably but someone needs to research how to do it.
Do you use a compiler which supports the final/standard variant of modules?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline sm0ke

  • Single posting newcomer
  • *
  • Posts: 2
Re: Support for c++20 modules
« Reply #2 on: April 17, 2021, 04:25:24 am »
I tried mingw64 snapshot version:
http://winlibs.com/
> GCC 11.0.1 snapshot 20210228 (experimental) + MinGW-w64 8.0.0 - release 1

It can compile modules when compile with "-fmodules-ts". But in the "export module _name;" _name should coincide with the file name. And file extension should be .cpp (not .ixx). Or it's not work.

Also... There is MSVC 19 Preview. Module file should be with .ixx extension (or with appropriate property).

Do not forget to recompile .cpp file that imports changed module. And module should be compiled before .cpp (or .h) file that its use. (make dependencies like with #include)

upd: I forgot to mention that clang can do with modules too, but it is too weird to configure to make it work.
clang i used from here:
http://winlibs.com/
GCC 10.3.0 + LLVM/Clang/LLD/LLDB 11.1.0 + MinGW-w64 8.0.0 - release 1
« Last Edit: April 17, 2021, 05:25:34 am by sm0ke »

Online The_GTA

  • Multiple posting newcomer
  • *
  • Posts: 14
  • Developer & Entrepreneur
    • EirDev
Re: Support for c++20 modules
« Reply #3 on: Today at 06:38:01 pm »
Hello sm0ke, I like your suggestion very much! Please add nice support for C++20 modules because they allow for advanced programming practices! This new C++ language feature enables very high-tech modern powerful development practices that can shape the future of native development in a significant way. Let me inspire you:
  • to use modules the cruft of C-style header files is no longer mandatory! Header files are only a thing for compatibility with C-only projects or system headers. There is now a C++-language-level space of function signatures and symbols inside of compilation units that can be activated by pure inclusion of module units and activation with the "import" statement.
  • a dependency tree where static modules depend on static modules is also possible, and much nicer so! Since you do not need header files anymore, you do not need to specify include directories for module-based C++ depedency projects anymore. This does remove nasty time-consuming project configuration steps. A big kudos to the C++ language team for this C++20 feature!
  • how does Code::Blocks IDE know about function declarations and definitions in case that they come from modules, not from header files of the same compilation unit? Does Code::Blocks support looking up of such language structures from across compilation units, such as from imported module compilation units? I hope so. And consider the bigger picture: does Code::Blocks support looking up of language structures from compilation module units from static library dependencies? A very special case of such is the C++ standard runtime (STL).

Code::Blocks must not leave the modern developer crowd behind! Get on the module-hype-train now. Developers like me will have even more reasons to promote your product as the "IDE with all the features you need". 👍😎
« Last Edit: Today at 06:58:16 pm by The_GTA »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13202
    • Travis build status
Re: Support for c++20 modules
« Reply #4 on: Today at 06:48:45 pm »
A big kudos to the C++ language team for this C++20 feature!
It would have been big in 2011. Now it is just late and as always overdone/over-engineered and from what I'm hearing/reading it doesn't solve the biggest problem in C++ - slow compile times.

Get on the module-hype-train now.
I think, I wait until it gets the module-just-works-train. :)

p.s. your message looks like the messages produced by the spam bots... :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Online The_GTA

  • Multiple posting newcomer
  • *
  • Posts: 14
  • Developer & Entrepreneur
    • EirDev
Re: Support for c++20 modules
« Reply #5 on: Today at 07:05:15 pm »
It would have been big in 2011. Now it is just late and as always overdone/over-engineered and from what I'm hearing/reading it doesn't solve the biggest problem in C++ - slow compile times.
Big engineering is the main idea behind new C++20 features. Leave no imaginable idea behind, break the old expectations with good language design. But I can understand your sentiment. You do not have to join the hype. The old way does just work, and does solve the problems in an equivalent way.

Slow compilation times is not a language problem but mainly how the compiler people implemented things. Visual Studio C++ has made huge leaps forward, I can attest to that through years of experience. Thus you should agree that the compilers do not deflect from the beauty of the language.

Get on the module-hype-train now.
I think, I wait until it gets the module-just-works-train. :)
You are stubborn. But I like your conservative ways!  ;D

p.s. your message looks like the messages produced by the spam bots... :)
Good things deserve to be promoted, my friend. We are in this fight together. Also I do promote your IDE this way. I do post links to your website on my websites as well as social media. Have a fancy to deserved attention. Your IDE is the greatest cross-platform native development platform IMO.
« Last Edit: Today at 07:14:29 pm by The_GTA »