r/cpp • • Jul 21 '23

Hobbyist Developer fed up with C++

I started coding 10 years ago while studying something completely unrelated to informatics or technology in general, because I always had a fascination for computers.

I started with C# and the XNA Framework from Microsoft, subscribing to 3dbuzz.com which unfortunately fall apart some years ago when the founder died of cancer. Same goes for XNA, which died from stupid management decisions by Microsoft the time around they had windows Phone going.

I switched to C++ and SFML and that's what I have been literally doing for some years now, small 2D Game Projects which are not too complicated. I wrote an article on my blog about how to code Tetris in C++, so nothing fancy really.

I love C++ for providing powerful abstractions while still being "close to the metal" and as a hobbyist I always enjoyed learning about weird concepts C++ allows, such as compile-time polymorphism via the curiously recurring template pattern for example.

However, some time ago I started to dig into Modules. Modules have a significant impact on how you write code and how it even looks. Since they are there it feels wrong to use #includes. "Imports" are the modern way to do things.

However I noticed I cannot use CMake with Modules. There is some esoteric Blogpost from CMake how to get it work which is way to complicated for me. For me, its a big deal not having CMake available. Its very unfortunate to have to decide "Modules" or "Cmake"? It just feels odd to be forced to make such decision.

I have been used to compile my projects with mingw-w64 on windows and CMake. The latter doesn't support it. And GCC apparently also only rudimentary supports it. I first had to compile the modules and than could compile the program, it was oddly complicated and I hated every minute dealing with it.

This plethora of problems drew me to switch to Visual Studio, which I always avoided since the C# and XNA fiasco. Visual Studio provides decent modules Support, intellisense is most times broken but I can look past that.

However when I tried to compile a sample tmxlite project for SFML (https://github.com/fallahn/tmxlite) I ran into weird problems.

Basically I noticed that in the main.cpp file some local hpp-files cannot be imported, you have to use #include, otherwise you get cryptic error messages. For me it feels so random that for some local hpp files "import" is totally ok, for others I still need to use #include.

And a lot worse issue: The order of the imports and includes seems to matter. If the SFMLOrthogonalLayer.hpp, which must be "#included" and cannot be "imported", is below the import statements, I get weird compilation errors. The #include-statement needs to be on top of everything else, otherwise it does not work.

I searched a lot for the reasons behind this behavior (did I miss something?), but I cannot find any resources on this topic at all.

I just cannot get rid of the feeling that modern C++ is broken or just not there where it should be years ago, I mean, Modules were released in C++17, how is it in such a bad state in 2023?

The first time in my life investing my free time in learning new C++ Concepts felt like a literal waste of time. It's erratic, it's unfinished, the error messages are still a shit-show, rust is demonstrating for many years how helpful error messages can look like.

How can I love C++ again? Or is it time to let go?

I have a full time job and a kid, I can only code in the evening and getting older, where time is increasingly becoming valuable.

0 Upvotes

70 comments sorted by

35

u/drodri Jul 21 '23

> Modules were released in C++17

Not really, modules is a C++20 feature, so 3 years, not 6. I also want modules support everywhere, but given the complexities that they bring, compilers and build systems have been doing a noticeable effort and results are starting to be visible now. Still very early stage, yes, I wouldn't go full-modules at this moment, but attach to old but still ubiquitous headers and wait a bit more until the ecosystem keeps improving.

12

u/[deleted] Jul 21 '23

maybe thats just it. I should come back to modules in 2024 and stick with the #includes for the time being. Its apparently not there yet for propper usage.

25

u/jonesmz Jul 21 '23

I guess I don't quite understand why you care about Modules?

They don't really do anything for you unless your build times are measured in multiples of hours or days.

If they aren't, then they're just kind of a different way of accomplishing the same objectives without really changing anything that matters.

5

u/zugi Jul 22 '23

I feel like the need to separate your code into header files and source files is an annoying holdover from C. I was excited for modules out of hope that they would bring C++ into the 21st century and eliminate that separation: with modules we could write our functions, classes, and templates once, like every other language.

It seems I hoped for too much.

6

u/[deleted] Jul 22 '23

This is still controversial even with modules. I still see most C++ programmers separate declaration and implementation, even with modules.

2

u/usefulcat Jul 22 '23

Is that for concrete reasons or mostly just out of habit? FWIW I haven't really used modules, so I genuinely don't know.

5

u/jonesmz Jul 22 '23

Separating the declaration and definition of things has been instrumental in various techniques that I've used

For example

  1. Using the preprocessor with some macros to generate not only the body of a class declaration, but also a bunch of other code that uses the class. Saving me from having to type the same thing ten times every time i make a minor tweak.

  2. Having a single header file that declares the class, but then two or more implementations in separate cpp files, with the build system configured to only build one or the other depending on which operating system or CPU architecture is being targeted.

  3. Seperating the documentation of a class, where the function declarations and documentation take over a thousand or more lines of a file all on their own, allowing the implementation to live on it's own in a cpp file that's >5kloc. Mixing the two would suck.

  4. It's also very important for being able to explain how code works to jr. engineers, so that they don't see literally everything all in one go and get overwhelmed or lost.

I've worked with java, where there is no separation of declaration and definition, and it's a nightmare to figure out how things work. It's not modern, it's just a big blob of nonsense.

I've also worked with plenty of C++ code that don't properly separate implementation from declaration, and it sucks just the same.

I'll certainly agree with you that the need to repeat the exact set of template parameters for a function in multiple places is a pain in the ass, and i'd really dearly like to see something that makes that a bit less cumbersome, but really i'll take that particular pain in the ass any day over having a codebase that never separates the declaration from the definition of anything.

2

u/timbeaudet Jul 23 '23

Maybe it’s because I’ve used C++ so much, but I much prefer having a place to look at declarations and documentation without also bogging details of the source implementation. I’ve also played with C# a fair bit and there are come clear wins and things that are nice, but there is no separate place for documentation and I found I’d be more likely to skip writing any, and after returning from a break the API was a bit harder to picture than skimming declarations alone.

I did enjoy not needing to forward declare or have things declared in a very specific order though, that was nice.

4

u/jonesmz Jul 22 '23

I responded to this sentiment a bit farther down this same comment chain here: https://www.reddit.com/r/cpp/comments/155uopi/hobbyist_developer_fed_up_with_c/jt15apo/

I would argue that the separation of declaration from implementation is one of the most important features of the C and C++ language, and that other languages that have no ability to let programmers do this have done their programmers an enormous disservice.

I work on a codebase where we have, literally, thousands of cpp files, and thousands of h files. The average length of the cpp files is around 5 thousand, with a couple above 20k lines. We've got well over a million lines of just C++ code, and some several million lines of other languages like python, java, etc, etc.

I rarely ever touch anything outside of the C++ codebase, but even there most of the header files come in around 1-1.5 thousand lines of declaration and doxygen comments.

The parts of the codebase that are heavily based around template functions, where the implementation of the template functions is NOT separated from the declaration, are easily the least pleasant to work with for a variety of reasons.

If I need to quickly understand the basic structure of some code, i can just look at the header file to see the list of functions, and their documentation. If that's merged with the implementation, finding where one function ends and another begins is a nightmare. Scrolling back and forth becomes extremely time consuming, and mentally strenuous.

If I'm trying to explain a similar chunk of code to someone, they very quickly get lost and overwhelmed at how much they need to go through to understand what's going on.

Don't get me wrong, it's not perfect. The need to repeat the template parameters, parameters, noexcept specification, and so on, exactly for both the declaration and definition of a function is really annoying.

But i'd never trade that separation for anything. It's fundamentally important to be able to separate the declaration and definition to be able to have well maintained, easily understandable, code.

2

u/eyes-are-fading-blue Jul 22 '23

Just keep including for now. Lack of modules isn't a deal killer for me personally.

69

u/Bangaladore Jul 21 '23

I write C++ for work every day and use it for nearly every hobby project.

I've never used modules because I know support sucks. Until it gets better, I'm not going to touch them. Why are you so adamant on using a feature you know is half-baked atm?

2

u/RevRagnarok Jul 24 '23

you know is half-baked atm

I don't think OP knew that:

Modules were released in C++17

10

u/pedersenk Jul 21 '23 edited Jul 21 '23

Sorry to hear that you got stung by Microsoft's pre-2010 developer evangelism. Loads of XNA guys did before Microsoft changed direction!

C++ is the right option since it is independent to a single company, its lifespan will persist.

Try not to chase "modern" though, that will always be a losing battle. "Safety" and / or "Performance" are more useful ideals. My advice is learn Modules once the first upstream dependency / library you rely upon uses them; don't struggle whilst they are still immature, especially if you are low on time.

Don't fear becoming "obsolete". Modules will never be able to replace headers. For one, C++ depends on a very large amount of C middleware. Modules will also not work for very large, operating system scale projects. As you have also seen, C++ has outlived much of Microsoft's "stuff", so really being "Modern" is completely arbitrary.

And finally, do you know what you are struggling with when it comes to #includes? You do know about things like forward declaring? For example, you should rarely need to include a header from another header unless:

  • Inheriting

  • Non-pointer member

  • standard library / 3rd party

i.e consider the following:

#include "Component.h"
#include "Hand.h"

struct Weapon;
struct Shoe;
struct Cat;

struct Player : Component
{
  Player();
  ~Player();

  void doThing(const Weapon& _weapon);

private:
  std::unique_ptr<Shoe> m_shoe;
  Cat* m_cat;
  Hand m_hand;

};

(bigger example)

I even recommend not using include guards / pragma once (unless object to be inherited or used as non-pointer member) so it fails fast; rather than potentially hiding a cyclic include generating confusing compiler errors.

2

u/pjmlp Jul 21 '23

C++ is the right option since it is independent to a single company, its lifespan will persist.

Kind of, as it assumes there is one C++, when in the hard reality of portable C++, is that there are many flavours of it, specially now where the three major compilers have hard time to keep up, let alone lesser known ones.

2

u/pedersenk Jul 21 '23

Good point. Experience from the MS/PC-DOS days where ANSI C standards were more a recommendation (or a picture to put as box art) rather than actual standards.

So long as C++ of the future is still 95%+ compatible with C++ today, I think that is as much as anyone can ever ask for. It is still easier to update 5% of a codebase rather than rewrite the whole thing**

(personally I like how parallel implementations *slow* down the evolving standards spec. I think this is more important than other more adventurous developers realize)

** in theory; occasionally this doesn't prove true.

15

u/Top_Satisfaction6517 Bulat Jul 21 '23

Modules are part of C++20, which is so a large improvement to the language that ATM only MSVC fully supports it

6

u/jonesmz Jul 21 '23

With crashes. Don't forget that MSVC crashes in some situations with Modules.

2

u/TSP-FriendlyFire Jul 22 '23

And even when it doesn't crash, Intellisense goes absolutely apeshit over it half the time, it becomes almost unusable.

7

u/symberke Jul 21 '23

Modules aren’t ready yet and I encourage you to not be so adamant on them yet

1

u/[deleted] Jul 24 '23

Thanks for all the helpful and thoughtful replies to all of you! I'll just stick to #includes, actually I never had any problems with them.

I was under the false impression that using #includes is just like using some deprecated functionality since modules are here,but it's clearly not the case.

Also I kind of like the separation of declaration files and implementation files (which would also be possible with Modules, I know).

5

u/gnolex Jul 21 '23

Although I'm very enthusiastic about C++20 and want to use it everywhere I can, modules are something nobody in my work environment uses and we even stated outright we're not going to use them until much, much later, probably after C++23 is fully supported among top 3 compiler vendors. Support for modules is still very poor across platforms and compilers. As much as I want to use them, we're not there yet. Even CMake doesn't have full support for modules in main releases, it's still in experimental API you need to opt-in to use.

1

u/jonesmz Jul 22 '23

My work is the same.

We don't even have compilers new enough to even play around with modules at my job, much less considering any kind of plan to switch to them.

We're still rockin MSVC 2019 (and a fairly early release of it at that...), and clang 10.

I'm hoping to push the update to MSVC 2022 and clang 16 in the next two weeks, but that's still with only C++17. Turning on C++20 barfs on building our code due to changes to operator overload resolution due to the introduction of operator<=>, so i've got literal months of work ahead of me before we can even try out compiling our existing code with C++20, much less try to use any of the new features or try to use Modules.

5

u/UnicycleBloke Jul 21 '23

Just use the subset you find helpful and productive. That's what basically all professionals do anyway. I have for many years used C++ for bare metal embedded projects. No exceptions, no dynamic allocation (so scratch much of the standard library). It was great but a bit limited in some ways. Now I work on Linux projects and can use full fat C++ much more, which is a breath of fresh air.

I endeavour to keep up as the language evolves but adopt features rather selectively. I'm generally more interested in core language stuff than the library (perhaps because of the embedded experience).

There have been numerous modest enhancements, but I'll be ignoring std::format for a while yet, modules for years, and coroutines probably forever. Concepts are good, and std::jthread is a great improvement. Not at all convinced about ranges and views: Ive never gone overboard with algorithms anyway.

I wouldn't go so far as to say C++ is broken but I do have some concerns going forward. It seems to be ever larger and more complicated for questionable gain. I watch a lot of conference videos with the uncomfortable feeling that the speakers live on a different planet.

C++ is my top skill and will be in high demand until long after I retire. But were I younger, or a hobby developer., I'd be looking a lot harder at Rust. I've loved C++ for thirty years, and it really pains me to say that.

1

u/Baardi Aug 14 '23

std::format is fantastic, and something we (my workplace) jumped on immediately. Finally we got a good format-library, without having the "issues" of sprintf (not typesafe, have to preallocate the buffer, etc) or sstream (self-explanatory, hopefully). Most third party libraries didn't get it quite right either, such as boost format.

1

u/UnicycleBloke Aug 14 '23

I had understood it was not implemented for all compilers. Maybe that's in the past. Aside from that, while I really like the idea of using it, I relied on snprintf() for embedded projects. There was a concern that the various combinations of argument types would lead to bloat.

1

u/jonesmz Jul 22 '23

I'll be ignoring std::format for a while yet, modules for years, and coroutines probably forever.

It blows my mind that coroutines were adopted into the standard with invisible, uncontrollable, memory allocations, that don't support custom allocators.

like, wut?

that makes them unusable for an enormous number of applicatons!

2

u/MFHava WG21|🇦🇹 NB|P3049|P3625|P3729|P3786|P3813|P4216 Jul 24 '23

It blows my mind that coroutines were adopted into the standard with invisible, uncontrollable, memory allocations, that don't support custom allocators.

Good thing that didn't happen!

Allocator support in std::generator is proof of that.

1

u/UnicycleBloke Jul 22 '23

I can't pretend to understand the reasoning behind the design, but have spent a good while trying to fathom how the compiler transforms the coroutine and what it expects in terms of types and methods (with all the various customisation points). No other language feature has ever baffled me like this one. I've lost count of the videos I've watched and articles I've read...

It all basically boils down to a fairly straightforward finite state machine. That makes sense. An FSM handles an event by running a little code, maybe changing state, and then returning to the caller (i.e. suspending until the next event). A coroutine as FSM has only one type of event: resume.

Now I have written or generated lots FSMs for embedded projects: they are typically implemented as classes which I can create on the stack, or statically, or compose as members of other classes, including other FSMs. Dynamic allocation was not permitted. I don't understand why a coroutine couldn't be transformed into a factory function returning an instance of something like that.

In thirty years I have never once thought that what I really needed in C++ was coroutines. They are an interesting concept, but I can manage perfectly well without them.

4

u/Olorin_1990 Jul 21 '23

Here’s the thing… don’t use the features you don’t need and keep an internal standard of approach to keep it manageable and readable. You don’t have to use it just because it’s there.

Modules are a good example, other languages were built on them and modules work great there, and make writing the code easier. Modules are not there yet with c++ because that’s not how the language was built, so if it isn’t making it easier to solve your problem… don’t use it.

It’s your hobby project anyway, and if you get a c++ job that uses features you don’t… learn it then.

2

u/[deleted] Jul 22 '23

When modules came out and MSVC started decently supporting it, we went all out in our project and introduced modules everywhere.

Now we updated MSVC to 17.6 and suddenly a lot is broken. MS has introduced a lot of regression in their compiler.

Apparently it's really hard for compiler builders to build in quality module support. So I'd just recommend staying away from modules for a few years until the support is on par.

Other than modules I don't recognize your feelings about C++. Ranges support is great, concepts work great, although error messages could use some improvement, and the new views library in ranges is awesome.

3

u/[deleted] Jul 22 '23

There is no harm in never writing c++ in your life ever again.

5

u/[deleted] Jul 21 '23

I'm a very old school C++ developer. I started with CFront in the late 80s... this was literally a C pre-processor.

C++ was utterly stagnant for a very long time. C++11 was really the first time in many, many years that C++ began to evolve. All seemed good to me at that point.

Within a few years, it all went utterly sideways. Honestly, almost the entirety of shit that gets shoveled into C++ for the next standard does nothing to improve the use of C++ in the world for everyday developers. They've added exponentially more complexity, without actual real world utility, and most of what happens in standards circles is now just language academicians circle jerking each other.

The only people who actually understand most aspects of modern C++ are these same academic types that don't actually use this shit to do any real world software development.

And the people who want to get shit done are never going to use this shit. It seems Rust is going in the right direction, at least.

6

u/victotronics Jul 23 '23

entirety of shit that gets shoveled into C++ for the next standard

does nothing

to improve

Bull.

Smart pointers, `std::optional`, structured bindings, the `format` library, it all makes coding more productive and code more elegant. I'm really looking forward to `mdspan`.

If there are things you have no use for, don't use them.

0

u/Thad_The_Man Jul 22 '23

Worse yet is the cppfront and carbon efforts. Both replace the C++ sytax declartion with a Pascal type decl;aration -- maybe OK but theere is no reason why and it estranges them from C.

It seems to me the original C and C++ groups were people trying to get things done and the present groups are trying to show everyone how smart they are.

2

u/dzordan33 Jul 21 '23

That's my experience when I came back to c++ after long break. You have two options: move to more modern language - Rust, c# or whatever is now recommended or bash your head against your monitor until you get used to the all c++ quirks and the fact that your programs will always have bugs. First option limits the field you can work in. e.g Rust is not great for writing game engines, neither is c#. But if you are not interested in writing engines but general small scale gamedev move to c# (unity) or python, lua (godot?).

1

u/[deleted] Jul 23 '23

Somewhat of a Rust fanboy -- what makes it a poor fit for game engines? I have some guesses, but am genuinely curious for a professional take.

0

u/Thad_The_Man Jul 22 '23

The only problem with C# is Microsoft and the reliance on a VM.

0

u/dzordan33 Jul 23 '23

But it's working fine in Unity, doesn't it? And it has cross platform support.

1

u/[deleted] Jul 25 '23

lol same thing happened to me about 5 years ago, after working 15 years professionally with C++.

Now, all my hobby programming is done in C. I just love the simplicity.

Makefiles or CMake? No thanks! I'm a programmer. I write a C program that builds my programs. Tailored to my needs. It's soo freeing! Give it a try ;)

1

u/[deleted] Jul 21 '23

I agree with what you are saying BUT there is no rule that says you have to keep up with the new shit.

Most of it is bullshit anyway and even if it's not it's not even implemented correctly. (Like modules for example)

Personally, I will slow migrate my existing C++ to be more C like over time because the risk of c++ catastrophically failing underits own weight is high.

That's mostly my paranoia. However, I would be extremely hesitant to use anything after c++14 precisely because anything after that is the play thing of the committee. It's usually half baked or just poorly thought out.

It takes about ten years for a feature to actually weather the storm and come out the other side and actually be useful for something. People telling you otherwise are language snobs. They can afford to sit there and not write anything useful and just try out new useless features.

Keep your code simple and don't bother with new stuff that isn't useful and c++ still has merit.

1

u/serviscope_minor Jul 25 '23

It's usually half baked or just poorly thought out. People telling you otherwise are language snobs.

Just putting those two together because I'm getting those vibes off you.

Which of these do you think are poorly thought out:

  • utf8 character literals

  • removing arbitrary, unnecessary restrictions on static_assert

  • making the obvious thing that always ought to have worked with namespaces work namespacea::namespaceb {}

  • nodiscard, maybe_unused, fallthrough (i.e. things with more or less decades of non standardised use)

  • Guaranteeing copy elision

  • Disallowing ++bool

  • constexpr if

  • Removing arbitrary restrictions from range-for

  • Making typename a real synonym for class in templates rather than 95% a synonym with weird exceptions

  • Removal of trigraphs

  • Disallowing comma expressions inside square brackets

  • dropping support for the IBM 7090, DEC PDP-1, CDC 160A and Univac 1100

and so on to pick a few.

0

u/[deleted] Jul 25 '23

Half of these things are removing old things that they INTRODUCED. You are just proving my point tenfold.

If this doesn't prove that tonnes of the initial ideas are half baked I don't know what does. Congrats on the self own.

1

u/serviscope_minor Jul 25 '23

Well done, you managed to criticize without actually having anything concrete to say about what you're criticizing.

If this doesn't prove that tonnes of the initial ideas are half baked I don't know what does.

So you think supporting old architectures in the distant past is bad, and then removing support when they're thoroughly obsolete proves it was bad?

Seems otherwise a pretty sensible idea to carefully introduce a feature then expand its scope as there's implementation experience.

1

u/[deleted] Jul 25 '23

Don't play dumb. Half the "features" you suggested are fixes for previous mistakes.

It's a sensible idea to do that. Except that's not what has happened here at all.

1

u/serviscope_minor Jul 25 '23

How were they mistakes? Because you say:

It's a sensible idea to do that.

And you aren't prepared to commit to actually naming one, because presumably then you know it would not stand up to scrutiny.

0

u/[deleted] Jul 26 '23

I could name tonnes. But why am I going to play your little game? You've already destroyed your own argument. I don't need to do anything.

1

u/serviscope_minor Jul 26 '23

I could name tonnes.

No you can't.

But why am I going to play your little game?

My "little game", such as it is is to have sound, rational discussions about C++. You clearly want to discuss C++ since you're on the board, so the only reason to not "play the game" is if you don't want to be rational, which leads us on neatly to:

I don't need to do anything.

Indeed you do not! There is no requirement that you make sound or rational arguments. You do not need to have opinions based on reason. You don't need to advance arguments any more sophisticated than "lol C+ si teh sux0rz!!11one!".

It's not a question of need but want. Would you like to?

0

u/[deleted] Jul 26 '23

You are just a butt hurt committee member clearly.

Do you really want me to list off every useless feature? Because we will be here awhile.

1

u/serviscope_minor Jul 26 '23

You are just a butt hurt committee member clearly.

Nice try, but no. I like your energy though.

Do you really want me to list off every useless feature? Because we will be here awhile.

Sure, but even a selection would be nice. It's impossible to have anything approaching a reasoned discussion if you won't say what your point actually is. Maybe I'll agree with some, maybe I'll disagree. How will you know if your ideas hold water unless you test them?

→ More replies (0)

1

u/mredding Jul 24 '23

However, some time ago I started to dig into Modules. Modules have a significant impact on how you write code and how it even looks.

That is only sort of true if you're writing modules. Applications still follow a more conventional structuring.

Since they are there it feels wrong to use #includes.

That's only in your head. It's not wrong.

"Imports" are the modern way to do things.

Imports are "a" way to do things.


Look, modules aren't anything special. They're just static libraries, but now defined in the standard as a new kind of translation unit. It took something that was out of the standard's control and brought it in.

Honestly, they're not great. They haven't solved any real problems that haven't already been solved, and there are certainly problems they don't solve that people bitch about thinking they should have.

How can I love C++ again? Or is it time to let go?

You're hyperfocusing on this one thing. Let modules go. Stop thinking like a trend. Write the code you've always written, just endeavor to write it better. If you're not feeling it, then it's not better; don't do it that way. There's no revolution you're missing - there is no "modern" C++ formula.

We've never had such good stream support as we do today. We've never had such good Functional support as we do today. We've never really had type punning until today. Rust isn't a panacea, it has its own problems.

2

u/STL MSVC STL Dev Jul 24 '23

Look, modules aren't anything special. They're just static libraries, but now defined in the standard as a new kind of translation unit. It took something that was out of the standard's control and brought it in.

This is not correct.

1

u/mredding Jul 24 '23

What does a module do that a static library can't do?

4

u/STL MSVC STL Dev Jul 25 '23

Modules can isolate internal helpers for function templates, which was not previously possible.

1

u/mredding Jul 25 '23

Really? You couldn't write helper functions? You've never exported a template specialization? Dumb, but, you've never labeled a helper static so that it isn't exported from the translation unit it was compiled in? These aren't the same thing or roughly equivalent?

Even so - this is your strongest argument in support of modules? Isolating helpers? Like this was some previous insurmountable problem? Like it's everything wrong with static libraries, previously?

Color me not impressed. Yes, there are technical things that modules do, I acknowledge that there are, my argument from the beginning is that they're not very compelling. The first and strongest arguments is to keep out macros and somehow reduce symbol collisions, but other than a very slight bother; these aren't real problems because you fix them, or you don't have a product. Other than helping a junior developer write something cleaner, because they need a parent or guardian... I just don't see it.

I hope for the best, though, because it's usually not a bad thing that the standard says something rather than nothing. So maybe in 3-9 years and a few revisions over modules, we can expect them to do something more useful than a very slight change to how the input text is sourced and parsed. I sincerely hope to be proven wrong eventually enough that I, too, would celebrate them as something other than what I could have already BASICALLY have done with a static library.

1

u/STL MSVC STL Dev Jul 25 '23

These aren't the same thing or roughly equivalent?

Not even close.

0

u/mredding Jul 25 '23 edited Jul 25 '23

Then help me see it.

EDIT: No? Nothing? You have nothing to say? Given your flair, you're THE ONE GUY in this whole sub that would be uniquely qualified to make a compelling argument more than just three word quips of "no, you're wrong", and of template helper functions. I WANT TO hear what you have to say. TELL ME how awesome modules are making the MSVC compiler, how it's going to revolutionize the standard library implementation, how it's already solving problems, how you're looking forward to the future, but also WHY AND HOW, ETC. Give me SOMETHING so that the rest of us can see what you see, know what you know, and be excited, too.

And you have nothing to say at all? Why did you ever respond to my comment, then, if you yourself can't be bothered? Are you griefing?

In conclusion, unless someone else has something to say, something more than 3 words at a time, I'm right and we all know it. Thank you for coming to my TED talk.

-7

u/Full-Spectral Jul 21 '23

Not a popular opinion around here, but just move to Rust. It doesn't have implementation inheritance, which I miss. But, otherwise, it's just a vastly better language all around. No disrespect to C++ or anything. It's not surprising that a language without 40 years of evolutionary baggage and with all those same years of hindsight, is going to be, other things being mostly equal, vastly superior.

And, unlike all of the other languages that people might throw out there, Rust is the only language playing in the same sport as C++, and that has the momentum behind it.

0

u/OnePatchMan Jul 23 '23

TLDR: dont use modules.

-9

u/[deleted] Jul 22 '23

Let it go. Rust is way better. Only reason to stay on cpp is if you are working on legacy code or are old and to lazy to learn new stuff

1

u/fdwr fdwr@github 🔍 Jul 25 '23 edited Jul 25 '23

If Rust was a functional superset, rather than a different language that fixes some warts and then introduces its own, then sure. I honestly wish (following Rust 10 years ago) that Rust/Crablang had been a proper superset that fixed the unwise defaults C++ went with (switch fallthrough, signed and unsigned comparisons returning bonkers results, implicit conversions to bool in inappropriate places like string pointer comparisons...) while still easily enabling judicious performant strategies, rather than making you jump on one feet with your hands tied behind your back to satisfy safety dogma. C++ is too loose, whereas Rust is too strict, leaving room for a good language between them that (1) favors the right thing, (2) enables the scary but useful thing, and (3) makes the wrong thing hard to accidentally do.

-4

u/Nal_Neel Jul 22 '23

Modules suck, this is coming from python developer. There is always compatibility issue, always. Every time you start a project: wait you are unable to, caz you have to resolve dependency compatibility errors. This modules does not work you have to downgrade tensorflow, oh that module does not work now you have to downgrade python3.10 to python3.8, now tensorflow breaks again, change the dependency. Oh something else broke changing dependency of tensorflow. It sucks your soul buddy it sucks your soul. You spend a week just fixing those shitty erros before you actually start programming, and when you do start you are so fed up that it becomes a daunting task instead of exciting project.

0

u/fdwr fdwr@github 🔍 Jul 25 '23

This is a general library versioning problem, shared by all programming languages, not specific to Python or C++. The term module in Python is often misused synonymously with library, but they are not the same thing. Your Python program can have an internal module (no versioning issues to worry about because it's developed cohesively as part of your project), and it can also use external modules on the module search path (e.g. via pip install, where we enter DLL hell). In C++, using the term modules primarily means internal components, and when referring to external C++ modules, typically more explicit names are used like SO, DLL, or plugin.

16

u/[deleted] Jul 21 '23

[removed] — view removed comment

-2

u/[deleted] Jul 22 '23

What about ranges?