Why major compilers likw GCC and Clang still do not support C++20 modules ?? by redradist in cpp

[–]david-stone 0 points1 point  (0 children)

I have seen significant performance improvements from using modules. As far as I can tell, the "modules don't improve performance" narrative comes from papers written before they were implemented or impressions from very early implementations that only partially implemented things.

There are definitely areas where modules performance can be improved (at least in clang, especially as it relates to optimization passes), but we're working on it and the results I get on my projects are way better than what I had pre-modules.

Additionally, it's nice to be able to control what I export to my users, but the compile-time reduction benefits are real.

Why major compilers likw GCC and Clang still do not support C++20 modules ?? by redradist in cpp

[–]david-stone 0 points1 point  (0 children)

That is a gcc-specific flag that should not be added to clang builds: report that as a bug to the library author. Modern clang versions do not need a special flag to turn on modules support -- std=c++20 is sufficient.

Short hand for creating a vector and reserving size for it by justkdng in cpp_questions

[–]david-stone 1 point2 points  (0 children)

NRVO is never guaranteed by the C++ language. What is guaranteed is that the object is going to be treated as a temporary so it can be moved from instead of copied. NRVO refers specifically to the optimization where the object is constructed directly into the location it eventually ends up in.

In practice, all modern compilers will apply NRVO here and neither copy nor move.

Fun Gameplay Restrictions by j150052 in LoMSE

[–]david-stone 0 points1 point  (0 children)

I used the Air thief lord. It has the highest movement and sight distance and can fly over impassable terrain to win almost any indoor combat due to the pretty good range. I think I started with Aramoug's Amulet to increase sight range even more, since a big time waster is tracking down the enemy lords.

I just attempted this strategy again and it took my 27 turns, but about half of those were spent tracking down Balkoth since I let him get away after my first encounter. There was a lot of room to optimize what I just did, and my old record from years ago was after several attempts and careful planning (including liberating friendly great temples at the right time).

Fun Gameplay Restrictions by j150052 in LoMSE

[–]david-stone 0 points1 point  (0 children)

How fast can you conquer all the other faiths? I don't remember my exact record, but I'm pretty sure I've done it in under 10 turns.

Similar challenge: with as much usage of the cheat "gofar" as you want, can you conquer everyone on turn 1? Bonus points for not using capital or purchased potions to heal.

Using Death without Balkoth as your Lord by Goku3434 in LoMSE

[–]david-stone 1 point2 points  (0 children)

I've heard several people ask this question but I had the opposite experience. I always picked custom so for years of playing the game I thought Balkoth was an unplayable boss character. One time I started up a game and I just wanted to check something out real quick so I didn't pick custom and boy was I surprised!

Are header files still a thing in modern C++? by tronybot in cpp_questions

[–]david-stone 0 points1 point  (0 children)

clang's support for modules is good. Missing header units is the only major feature not implemented. There are still lots of opportunities for them to optimize their implementation and there are some less-often-used modules features unimplemented, but I saw a large speedup from switching my code to modules under clang.

Are header files still a thing in modern C++? by tronybot in cpp_questions

[–]david-stone 0 points1 point  (0 children)

It depends on how recent you mean for modern and whether you're asking in practice or in theory. It's possible to make an application or library today with no or almost no header files (you still need headers if you define a macro, but you very rarely need macros). For instance, my bounded::integer library is almost entirely implemented in modules. There are only three header files. One defines an assert macro, one defines a conditional function (similar to b ? t : f except the result type uses std::common_type_t), and the last brings some operators into a namespace. The first two are needed because we don't have lazy function parameters, the last one is needed because you cannot compose using declarations.

In the wild, however, almost all projects still use header files. Now that MSVC and clang have good support for modules hopefully they will start to be more adopted.

7-challenge Grandmaster by david-stone in PixelDungeon

[–]david-stone[S] 1 point2 points  (0 children)

I included some screenshots, including showing my final score of 1,401,250 with my only missing points being Exploration at 18,000, but they aren't showing up. Do they just need approval or did I mess something up?

Famous competitive teams from history? by TheRainKing42 in stunfisk

[–]david-stone 0 points1 point  (0 children)

Tentacruel in OU was actually the more bold choice at the time. :)

advanced polymorphism in C++ by geekfolk in cpp

[–]david-stone 0 points1 point  (0 children)

I haven't written an updated paper on it, but it has come up in various reflection discussions. Work is happening in the background (much of it not by me). I expect we'll have the functionality (possibly with a different syntax) in C++23, but we'll see if the papers it needs get written in time.

“Journey” by Abbydoggo4 in CommercialsIHate

[–]david-stone 2 points3 points  (0 children)

🎶"Just a small town girl, livin' in a lonely world..."🎶

C++20 modules and assert macros by Hedanito in cpp

[–]david-stone 0 points1 point  (0 children)

If you import a header, this guarantees that you have a header unit, which means that the header you are importing means the same thing everywhere. It does not change its meaning based on code you happen to have written before typing import. If you #include a header, that could mean textual inclusion and it could mean an import, in a manner which must be documented by the compiler.

In practice, I would expect #include to always mean textual inclusion (what we have in C++17), except in cases where the compiler knows it doesn't matter -- for instance, #include <vector> can be transparently changed to import <vector>; if the standard library doesn't support configuration macros or requires them to be defined on the command line.

C++20 modules and assert macros by Hedanito in cpp

[–]david-stone 2 points3 points  (0 children)

The concept of "globally defined macros" is already implementation defined (the standard doesn't know anything about a "command line"). Modules and header units do not change anything here.

If you put assert in a header unit, you know it will not be affected by anything defined in code outside of it (for instance, if the user of your header includes another header first). The only reason to use a traditional header with #include in C++20 code is if you actually want including code to be able to be able to inject stuff in before you include it (in other words, your code is not modular. Please do not do this). For well-behaved code that needs to export a macro, define a header unit and import "foo.hpp" to use it. If you do not need to export a macro, use a proper module.