3 ms·
As long as programmers still have to deal with header files, all of this is lipstick on a pig.
by VerifiedReports 7mo ago
As long as programmers still have to deal with header files, all of this is lipstick on a pig.
- jjmarr 7mo agoYou don't on new projects. CMake + ninja has support for modules on gcc, clang, and MSVC. This should be your default stack on any small-to-medium sized C++ project. Bazel, the default pick for very large codebases, also has support for C++20 modules.
- VerifiedReports 7mo agoThanks. It's been a long time since I started a C++ project, and I've never set up any build chain in Visual Studio or Xcode other than the default.
- sgt 7mo agoHow about using Zig to build C++ projects?
- jjmarr 6mo agoI haven't used it. That being said, while it looks better than CMake, for anything professional I need remote execution support to deviate from the industry standard. Zig doesn't have that. This is because large C++ projects reach a point where they cannot be compiled locally if they use the full language. e.g. Multi-hour Chromium builds.
- sgt 6mo agoSurely Zig can also be invoked using any CI/CD flow running on a remote machine too.
- jjmarr 6mo agoI'm referring to this: https://github.com/bazelbuild/remote-apis https://github.com/bazelbuild/remote-apis Once you get a very large C++ project with several thousand compilation jobs over hundreds of devs, you need to distribute the build across multiple computers and have a shared cache for object files. Zig doesn't seem to support that.
- duped 6mo agoI have yet to see modules in the wild. What I have seen extensively are header-only projects.
- jjmarr 6mo agoYou're not supposed to distribute the precompiled module file. You are supposed to distribute the source code of the module. Header-only projects are the best to convert to modules because you can put the implementation of a module in a "private module fragment" in that same file and make it invisible to users. That prevents the compile-time bloat many header-only dependencies add. It also avoids distributing a `.cpp` file that has to be compiled and linked separately, which is why so many projects are header-only.
- FrostKiwi 6mo agoIt's the fault of built systems. CMake still doesn't support `import std` officially and undocumented things are done in the ecosystem [1] But once it works and you setup the new stuff, having started a new CPP26 Project with modules now, it's kinda awesome. I'm certainly never going back. The big compilers are also retroactively adding `import std` to CPP20, so support is widening. [1] https://gitlab.kitware.com/cmake/cmake/-/work_items/27706 https://gitlab.kitware.com/cmake/cmake/-/work_items/27706
- duped 6mo agoweird to blame build systems for a problem caused by the language
- deleted 6mo ago[deleted]
- 72deluxe 6mo agoI don't understand this at all. There are modules. But headers are perfectly fine to deal with and have been for decades and decades! Next you'll be arguing that contents pages in all books should be removed.
- VerifiedReports 6mo agoWhat an absurd attitude. The gymnastics to avoid circular inclusions alone are something nobody should be giving a thought to in the 2000s. "But headers are perfectly fine to deal with and have been for decades and decades!" I would have thought this was a joke... but your follow-up indicates otherwise. So what are you going to float next? "So what if people broke their arms hand-cranking their cars to start them! People did it for years, so we shouldn't move to electric starters! Or automatic chokes!" "And these electric ice boxes are for the birds! Speaking of which: People flying through the air in machines? POPPYCOCK!"
- 72deluxe 6mo agoI honestly don't understand. Circular inclusions are something to deal with, but it's a tree.... so how can a leaf contain a branch?? I know C# does some magical things (I know not what) to avoid this since there are no headers so you can refer to something in the same assembly/namespace thingy, but it's very different to how C++ compiles and links? I wasn't saying that progress should be stinted, but that complaining about something with the expectation that it magically be solved is a strange view of the world. Do you also just assert that poverty and war shouldn't exist?
- pjmlp 6mo agoI use modules in all my private projects since the last two years.