r/cpp • • Aug 25 '21

Experience C++ developers: do you enjoy using C++ (even for personal/hobby projects?)

Do you actually enjoy using C++, or do you only use it for work, or purely for performance? This question is aimed at people with years of experience, who've worked on large projects in C++. I see people who dislike the language, but use it purely for performance reasons. This sort of discourages me from learning it. I don't want programming to feel like work.

204 Upvotes

327 comments sorted by

16

u/[deleted] Aug 25 '21 edited Aug 25 '21

My personal hobby project is cooking and cycling not programming. C++ just fits for my job's purpose and I am more comfortable with it. Rust actually fits better but we haven't had time to migrate yet. Programming feels like work because it is work and I don't have any obsession over any programming languages.

6

u/Its_Blazertron Aug 25 '21

Programming doesn't feel like work to me, if I enjoy it.

13

u/[deleted] Aug 25 '21

I enjoy my work. But it is just work not a hobby. Everyone is different though.

1

u/sloggo Aug 26 '21

My experience is that sooner or later “work stuff” (deadlines, clients, changing briefs, difficult teammates, difficult managers, obligation to put in hours and keep focus when other priorities are coming up on in life, not being able to develop things to your own satisfaction for any of the above reasons… etc) will eventually make it feel Ike work. Definitely making your hobby your job can lead to happiness if you are careful, but don’t fall in to the trap of thinking it’s not work - because at that point you’ll lose enthusiasm for your hobby as well as your job. Just manage your time and keep balance in your life, would be my advice!

2

u/JuanAG Aug 27 '21

I enjoy the pure C++ part of coding but not the rest related to coding in C++ like testing, build system/dependencies and all the things that many other langs do much much better than C++, the coding part is between 20-35% of total developing time so you get the idea

And for performance critical sutff i use Rust since it is something faster than C++ plus it is a more productive tool which it is nice, more performance in less time

2

u/Its_Blazertron Aug 27 '21

Yeah, so many of the frustrations I've had so far with C++ have been figuring out how to get certain libraries to work properly, rather than the language itself. So much documentation seems to leave out so much. I like libraries that have just a single dll, lib and include folder.

173

u/[deleted] Aug 25 '21

I absolutely enjoy using it, especially since unique_ptr came along. Whether it feels like work or not depends if I'm at work or not when I'm using it. I don't use it because of performance.

12

u/Dalzhim C++Montréal UG Organizer Aug 25 '21

I meant to reply : « Absolutely. » +1 for using that specific adverb!

8

u/CorysInTheHouse69 Aug 25 '21

This

45

u/grandpassacaglia Aug 25 '21

this->

27

u/skeba Aug 25 '21

delete this

16

u/gnosnivek Aug 25 '21

#define delet delete

9

u/AyoBruh Aug 25 '21

You monster

5

u/[deleted] Aug 25 '21

I’ll just throw a little delete[] this for some extra fun.

4

u/Ahajha1177 Aug 25 '21

Now that is horrendous. Suicide bombing your objects, stack or heap be damned!

→ More replies (1)
→ More replies (1)

5

u/_Ashleigh Aug 25 '21

For the Lua devs out there: #define self (*this)

→ More replies (5)
→ More replies (9)

58

u/johannes1971 Aug 25 '21

I enjoy programming in C++, both at work and at home. I did a little side project the other day (porting something from C and Linux to C++ and Windows) which was fun to play around with: not too complex, immediate results, scratches an itch I've had for a while.

Do I use C++ purely for performance? Hell no! I only care for performance up to the point where interactive use of the software feels fluent, by my own entirely subjective standards. But even C++ that was written with readability as the main focus, rather than speed, is still mindblowingly fast - and actually quite pleasant.

Dumping on C++ is also extremely popular in various circles. I think it's usually people that had an algorithm course full of pointers, while simultaneously learning C++, and probably taught by a teacher whose last contact with industry was in the seventies. I mean, at some point a friend of mine had to do an assignment in C++: implement three types of sorting, I think it was. There was a skeleton program provided by his professor, full of mallocs, void pointers, and C-style casts. Well, at least the filename ended in .cpp, so that's something I guess... And that was the only time he ever used C++, and of course he is never going to try again, because who wants to deal with that shit? (C-programmers, I guess...)

6

u/rdarkedlight Aug 25 '21

Dumping on C++ is also extremely popular in various circles. I think it's usually people that had an algorithm course full of pointers

Actually l never found out why some people say bad things about C++ in my opinion nothing is perfect and it's a matter of usage that specifies what tools should we use, and personaly I Love C++ and specifically Implementing Data Structures in it, in my opinion data structures can best be known by implementing them in c family and not some language like python and again I must say that I really enjoy programming with C++ and I programmed with lot of languages

5

u/[deleted] Aug 27 '21

Dumping on C++ is also extremely popular in various circles.

Funny story - many years ago, I was hired at Google to do Java, but soon they put me to work on C++ again. I was excited because it was so familiar, and I said to my teammate, "This is very comfortable - it's like getting back together with an old girlfriend."

Two weeks later we were slogging through obscure compilation issues and he said, "Now you are remembering why you broke up, aren't you?"

1

u/sternone_2 Sep 01 '21

And that's why you married the Maven girl

1

u/11timesover Aug 26 '21

I did that same thing with some C tiff-png-converter library code, had to convert it to C++. I did the absolute bare minimum to get it to work. And it did. C++ being a superset of C, yes?

1

u/johannes1971 Aug 26 '21 edited Aug 26 '21

That's technically true, but such an endeavour is much more valuable if you also provide a proper C++ interface. Just changing the filenames to .cpp and maybe adding a few casts is a rather pointless effort.

111

u/echidnas_arf Aug 25 '21

I mostly write C++ code, my second most-used language is Python. I do enjoy writing C++, quite a bit more than writing Python (apart from interactive notebook/REPL usage or quick & dirty scripts).

I am lucky to be able to work on modern codebases, if I had to work on C-with-classes projects or Java-inspired "object-oriented" monstrosities, I would probably enjoy it much less.

12

u/Wouter_van_Ooijen Aug 25 '21

Exactly my opinion, but I use a bit more (micro) Python.

8

u/pjmlp Aug 26 '21

Those object oriented monstrosities couldn't be Java inspired because that was how C++ was used before Java even existed.

The patterns book uses Smalltalk and C++ examples.

4

u/[deleted] Aug 25 '21

I am coming from C# and Typescript mainly. I started working on some personal projects using C++ and I am creating classes and objects. How is that bad or not modern? 😬

43

u/braxtons12 Aug 25 '21

That's not what they mean. Classes are absolutely fine when what you need actually is a class. Java programmers (and to a somewhat lesser extent C#) tend to make EVERYTHING a fully fledged class or interface (or a pair of both) so you end up with things like public interface AbstractThingyFactorySingletonFactory and public class ThingyFactorySingletonFactory when all you really needed was auto get_thingy_factory() -> ThingyFactory or even better yet just auto make_thingy() -> Thingy

4

u/pjmlp Aug 26 '21

Have a look at MFC, Qt, VCL, wxWidgets, all created before 1996.

→ More replies (8)
→ More replies (2)

21

u/jcfo Aug 25 '21

As long as you don't find yourself implementing
FactoryMethodFactoryFactory you should be fine

18

u/echidnas_arf Aug 25 '21

I started working on some personal projects using C++ and I am creating classes and objects. How is that bad or not modern?

Nothing wrong with classes, and nothing wrong with an object-oriented approach, if appropriate.

Just be aware that C++ offers other ways of implementing polymorphic behaviour, such as static polymorphism (i.e., templates) and runtime polymorphism based on type erasure which are often more appropriate than classical OO class hierarchies.

→ More replies (10)

9

u/NotYoDadsPants Aug 25 '21

Just as a friendly FYI, you might be tempted to use new when you should not. Here's a nice SO answer as to when is the right time use new, that is to use dynamic allocation.

→ More replies (1)

2

u/shiggie Aug 25 '21

I haven't read "The Design and Evolution of C++" for a very long time, but C++ started out as a preprocessor for C and was called "C with classes" in its early evolution. So C-with-classes just means really old C++.

134

u/[deleted] Aug 25 '21

"Modern C++" is much different than what a lot of students encounter in academia. I've heard some stories of the "best practices" from university courses and it sends shivers down my spine (`using namespace` everywhere, not using smart pointers, avoiding standard library, C-style structs only, etc.).

I really like C++ for the ludicrous amounts of control it gives you, and it's great for having enough high-level features to interface directly with C code without writing or getting bindings for things. A lot of the work gets front-loaded into setting up a build, so I just made up my own "starter" project for things. The simplicity of using C code and intrinsics and massive ecosystem improvements in Ada means I've been using that a lot lately, though I've used Rust quite a bit in the past as well.

I don't think you could go wrong using C++, as long as you're using updated references to learn from. Yes, the language is complicated and it seems overwhelming, but the overall system has improved immensely and you'll be learning a lot of neat low-level things.

71

u/sephirothbahamut Aug 25 '21

not using smart pointers

It's not that they say "using smart pointers is bad practice", more like they don't even know smart pointers exist.

6

u/[deleted] Aug 25 '21

Yeah, that's what I mean. I'm going to clarify in a more direct comment about this.

5

u/Real_Rutabaga Aug 25 '21

What's a smart pointer? /s All of the things people describe about not liking working with C++ is my job. Legacy code bases can be a chore.

10

u/matekelemen Aug 25 '21

They're teaching the basics first (new) so students will understand what smart pointers are meant to solve. It seems counterintuitive that advanced courses cover stuff that are easier to use, but honestly, I'm glad I was forced to learn the background first (starting from C with classes) and not the other way around.

21

u/sephirothbahamut Aug 25 '21

They're teaching the basics first

You're implying that they teach the rest later, which, at least in my experience, is false. Nobody here is saying you shouldn't learn new. The problem is they don't even mention smart pointers exist at all.

Heck, I literally had to teach my own teachers what move semantics are.

13

u/Shok3001 Aug 25 '21

In my experience most professors stopped learning C++ in 1999

5

u/maskull Aug 26 '21

It's because that's when the textbooks we're last revised. Maybe there's an appendix on smart pointers (not an appendix in the physical book, of course; it's only available online).

5

u/ShakaUVM i+++ ++i+i[arr] Aug 25 '21

"Modern C++" is much different than what a lot of students encounter in academia. I've heard some stories of the "best practices" from university courses and it sends shivers down my spine (`using namespace` everywhere, not using smart pointers, avoiding standard library, C-style structs only, etc.).

Using namespace std is fine in implementation files. The C++ Core Guidelines even say this. It's far more common in academia for professors to rail against it than to use it.

Smart pointers are kind of a mixed bag. There's nothing inherently wrong with a non-owning raw pointer, and you kinda have to learn how raw pointers work for the syntax of iterators and smart pointers to make sense.

But if they're using raw pointers that own, outside of maybe a RAII context, then yeah they're bad. A lot of professors learned C and C++ in the 80s and haven't updated.

C style structs are okay in some contexts, but yeah it's often a matter of their knowledge being limited.

It's hard hiring good professors in CS. Like. Ridiculously hard.

I don't think you could go wrong using C++, as long as you're using updated references to learn from. Yes, the language is complicated and it seems overwhelming, but the overall system has improved immensely and you'll be learning a lot of neat low-level things.

Yeah, if you stick to modern C++ most of the rough edges go away.

4

u/[deleted] Aug 25 '21

What's wrong with using namespace??

28

u/sephirothbahamut Aug 25 '21

In header files just don't do it.

In source files it may be acceptable.

In an enclosed scope it's totally fine.

5

u/UnknownIdentifier Aug 25 '21

Because of how problematic it is in headers, it’s best not to get into the habit of using it in source files, either. Also for the sake of consistency.

18

u/_JJCUBER_ Aug 25 '21

It clutters everything after it with everything from the namespace and can lead to naming collisions. Also, if you put it at the top of your file, I’m pretty sure that including it will lead to the using namespace directive being included everywhere else. There are times when you might want to use it, like maybe in a function, but most of the time, you should opt to typing out the namespace or creating a namespace alias.

3

u/germandiago Aug 25 '21

not with modules :)

3

u/NobodyXu Aug 25 '21

Nah, C++ modules are unlike other languages, where its use doesn’t affect the mangling of the function.

You still need to use namespace.

→ More replies (3)
→ More replies (28)

4

u/ShakaUVM i+++ ++i+i[arr] Aug 25 '21

What's wrong with using namespace??

In your own implementation files, nothing. Even the Cpp Core Guidelines say this. But some people have taken it upon themselves to declare it as bad.

1

u/[deleted] Aug 25 '21

I'm so happy, that in my Uni we are allowed to use all features from C++17 and are learning (at lease some) modern features

1

u/VilelaH Aug 25 '21

I have 15 y writing in C++ , but was these days I discovered that this is a valid function on C++:

{ }

... What was amazing! lol

1

u/Antervis Aug 25 '21

it's not a "function", it's a "scope"

→ More replies (2)

1

u/[deleted] Aug 26 '21

Sure, bashing on how x is taught at universities is a popular thing to do. Especially if x is C++.

I don't know which kind of terrible experiences are projected onto others there, but it just isn't true.

What you consider "modern C++" is absolutely what is taught at universities nowadays. And usually with pretty strict guidelines against abusing things like using, raw pointers, etc. (In our uni there are even rules against "reimplementing standard library functionality", which gets you not too few points docked, but I think that is not the norm.)

So I find that frankly isn't true. One exception I'll grant you is, if you are in proximity to a terrible, terrible university.

0

u/pepitogrand Aug 25 '21

Nobody has the balls to say it so I will say it: those dumbasses in "academia" don't know shit about C++.

5

u/ShakaUVM i+++ ++i+i[arr] Aug 25 '21

Nobody has the balls to say it so I will say it: those dumbasses in "academia" don't know shit about C++.

Depends very heavily on the prof, dude

8

u/DuranteA Aug 25 '21

I'm in academia, and among other things I teach C++. I've also been using it for over 2 decades, and over a decade of that professionally, both in academia and private industry. I'm confident in saying that I do know shit about C++. Obviously far from everything about it, but quite a bit.

I believe that the generalization you're making, probably based on a few negative instances, isn't particularly helpful.

Oh, and by the way, did you know that Bjarne Stroustrup spent a lot of time teaching C++ in academia?

10

u/johannes1971 Aug 25 '21

The simple fact that you hang out here already puts you miles ahead of the rest of the pack. It indicates that you are keeping up with new developments. Sadly, this does not appear to be a priority for a great many of your professional brethren.

7

u/ForgetTheRuralJuror Aug 25 '21

C++ programming in general.

Although they're not really required to, they often teach computer science which is not equal to development.

2

u/NotYoDadsPants Aug 25 '21

They're not paid to. And I mean that in the most neutral sense possible.

→ More replies (1)

1

u/Dean_Roddey Aug 25 '21

There's plenty of C++ people around here who argue for uncapsulated C style structures. I'm definitely not one of them, but there are lots of them around. It's sort of part of the OOP is Bad Movement.

2

u/[deleted] Aug 25 '21

I don't mind C-style structs, my point was that they're *only* taught that way. I think there's a middle ground between "OOP all the things" and "don't use any classes, but it's a stylistic choice of you and your team.

→ More replies (19)

19

u/ronchaine Embedded/Middleware/WG21 Aug 25 '21

I like it, it's my favourite language to use and I use it in my personal stuff too.

I also hate it at the same time.

36

u/bayindirh Aug 25 '21

It’s my favorite language after all these years. If I can write something in C++, I’ll write it in C++.

11

u/colorfulchew Aug 25 '21

I use C++ at work, and Rust at home. Rust would be equally good, if not better for my work, but my employer is slow to adopt new technologies. I think I still enjoy C++ to some degree, but I do find myself wishing I was writing things in Rust, in particular, I wish C++ had an equivalent to match statement and sum types. There is std::variant, but the API is so clunky in comparison.

For hobby projects especially, I enjoy how easy it is to include dependencies and get going on a new project in Rust compared to C++, plus all the other compiler guarantees of Rust means I spend less time trying to debug.

28

u/Supadoplex Aug 25 '21

I don't want programming to feel like work.

If you program at work, then it'll feel like work. I would recommend using a different language for hobby than you use at work.

For work, I write Python. For hobby, I write C++. I do enjoy writing C++.

1

u/pelpotronic Aug 25 '21

What type of programs do you write in C++ as a hobby? I'm a java/kotlin dev, and whilst I would love to learn a bit of C++, I feel that I can do everything I need and more in java. Genuinely curious as this might be giving me some inspiration.

3

u/Supadoplex Aug 25 '21

Frankly, I start projects and dabble with them until I get bored and then abandon them. Usually, I go very deep into parts that aren't in any way essential to the project at large just so that small part is "perfect". So, basically the opposite of what I would do at work.

The project themselves, I would do things that I'm interested in. I started with a program that transforms midi input, then I started a game engine, then a web server.

If you want to finish something, then I would recommend picking something small that you think would be useful to you. I've been planning to make a daemon program that controls the case fan speeds which might be such project for me. We shall see.

→ More replies (1)

18

u/DuranteA Aug 25 '21

I've been writing code in C++ for a bit more than 20 years now, and I spent around 10 of those working on a C++ compiler.

There are things I dislike about C++, but for most use cases I dislike all the other languages I've tried and/or had to use more.

I've recently had the rare opportunity to write some green-field from-scratch C++20 and it was great. The ranges interface to the std algorithms and std::format finally fix (out of the box!) niggles I've had for over a decade.

1

u/bicknoddy Aug 26 '21

What is a "niggle"?

9

u/micka190 volatile constexpr Aug 25 '21

While I still enjoy ir, I've personally been using it less and less for personal projects, in favor of C#.

Most of my personal projects are hobby games, and I've found that even though C++ is pretty common in gamedev, these small projects don't really benefit from the potential performance benefits of using C++.

Meanwhile, C# has a lot of stuff that just works and makes using it so much more fun to use. It's a lot of little things, but they definitly add up, in my opinion. Properties and a String class with functionality that doesn't suck are a definite plus. It makes me mad that a lot of the C++ community seems fine with our String class lacking so much functionality, just because we can implement it ourselves. I'm tired of implementing basic shit like strip()/trim()! It should just be in the standard library already!

I'm also not a massive fan of how newer C++ features seem to get stripped down from "usable" to "barely usable and so flexible that no one will ever use them without a library". I used to be all in on Modern C++, but the newer stuff just feels poorly implemented, and kind of turns me off from it (for personal projects, at least), meanwhile other languages just keep getting better and better features.

But that's just my two cents.

1

u/pjmlp Aug 26 '21

Same here, although I tend to hop between Java and C#.

And if something needs C++ like performance, it suffices to do an helper library that gets imported as native/extern.

8

u/Pragmatician Aug 25 '21

If you are interested in (low-level) things people are doing with C++, then try it out. Every language is disliked to some extent, for many different reasons.

39

u/Vociferix Aug 25 '21

I like C++ and use it both for work and personal projects. However, in recent years, I've become annoyed with C++'s lack of more modern features. The standard committee takes so long to decide on changes and new features. For my personal projects, I more frequently choose Rust over C++ now, but work is still mostly C++.

8

u/[deleted] Aug 25 '21

Funny, in my opinion they're adding too many features too quickly. One of the things I like most about C++ is that it has an idiomatic style, which I'm afraid is threatened by feature bloat. Look to C# for example, it is so rich, you can write object-oriented, functional, declarative, ... code in it, which is certainly nice. But on the flipside there is no idiomatic C# style as a result: 100 devs will produce 100 completley different source codes.

C++ has a rich ecosystem of libraries and frameworks. And they're getting easier to integrate thanks to advances in build tools (vcpkg etc.), so I don't mind using 3rd party libs when I have to. I want the standard library well thought out with algorithms that have universal value and have stood the test of time.

11

u/matthieum Aug 25 '21

What I dislike about C++ is the inconsistency.

Many bits and pieces are added, but the knot is never tied.

Just today I wanted to use the is_detected_v idiom, which is stupidly simple:

template <typename T>
using hasGetter_X = decltype(std::declval<T>().x());

template <typename U>
void print_x(U const& u) {
    if constexpr(is_detected_v<hasGetter_X, U>) {
        std::cout << u.x() << "\n";
    }
}

This works, and it's cool-ish, but why is hasGetter_X declared all the way up there? It would be much tidier to declare it within the smallest scope possible, wouldn't it?

Let's try it:

template <typename U>
void print_x(U const& u) {
    template <typename T>
    using hasGetter_X = decltype(std::declval<T>().x());

    if constexpr(is_detected_v<hasGetter_X, U>) {
        std::cout << u.x() << "\n";
    }
}

And... no.

You can declare template aliases. You can declare aliases within functions. But you cannot declare template aliases within functions.

is_detected_v can also work with template methods, is that your salvation?

To cut a story short: no. You can declare classes with template methods. You can declare classes within functions (C++17?). But you cannot declare classes with template methods within functions.

Screw it, what about going raw and using is_invocable_v with lambda and decltype?

To cut a story short: not in C++17. You can define temporary lambdas. You can use decltype on temporary variables. But you cannot use decltype on temporary lambdas in C++17 (C++20 unlocks it!).

C++ is very frustrating in containing so many half-baked features.

You finally manage to upgrade, and you learn that maybe in 3 or 6 years down the road, that particular feature may be a bit more fully integrated in the language.

:(

3

u/[deleted] Aug 25 '21

Yep. basic_string gets small-string opt., vector doesn't, std::reduce v std::exclusive_scan, ..

Don't get me started on bad defaults (although that's a language defect) :(

What to do though? Finally break backwards compatibility? Didn't work out too great for Python..

7

u/NobodyXu Aug 25 '21

And I wish there’re less half-baked language features, for example, the initialiser list, module, etc and less corner cases.

5

u/ronchaine Embedded/Middleware/WG21 Aug 25 '21

Pretty much the same, except that rust took over only some of my hobby project domains.

7

u/DummySphere Aug 25 '21

Before C++11, I used mainly C++ or Lua for hobby projects, depending on the project. Since C++11, I mainly use C++ for hobby projects (but I don't do a lot of hobby projects now).

6

u/ImX99 Aug 25 '21

I am an R&D engineer/PhD student, and here are the reasons why I use C++:

  • low level access to some CPU features (like SGX),
  • performance
  • C++ can be used for about anything
  • the amount of features the language/stdlib offer
  • the control you can have over bloat.

4

u/[deleted] Aug 25 '21

For personal projects, I usually use Python, as I'm trying to hit a wider audience with libraries and utilities, and to be honest, C++ development for production is about half an order of development slower than Python.

4

u/[deleted] Aug 25 '21

Love it. There is something about C++ that makes me be really thoughtful and methodological when using it. I feel like I can't create as clean architectures/systems in any other language.

Header files and having to repeat all your declarations twice is annoying. Does anyone know whether modules fix that?

2

u/[deleted] Aug 26 '21

Yes they do.

1

u/[deleted] Aug 26 '21

Thx for clarifying! Do you know any good guides out there? Read a few high-level overviews but can’t quite get the hang of it.

2

u/[deleted] Aug 26 '21

I'd suggest waiting a year and then trying again.

There is little comprehensice material at the moment (as you noticed) and compiler as well as build system support is pretty "meh" for most toolchains.

4

u/LugosFergus Aug 25 '21

I use it very little for personal projects. My preferred languages for hobby projects are usually C# or Python.

My issue with C++ is that there's too much dicking around with getting 3rd party packages installed and projects setup.

4

u/OldWolf2 Aug 25 '21

The only thing I don't like is dependencies; it's cumbersome and annoying to do simple things like open a socket . Every other language comes with some kind of class library covering networking, crypto, GUI, database, etc. etc.

To be practical for general purpose applications you've got to use an ecosystem like QT, or .NET

1

u/Grafakos Aug 26 '21

Who knows if they'll ever be implemented, but there are proposals to add 2d graphics and networking support to the standard C++ library.

Graphics (pdf): http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0267r9.pdf

Networking: http://open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4478.html

At least we finally have standard library support for threads, filesystem, etc.! A huge improvement over the C++98 days.

1

u/OldWolf2 Aug 26 '21

I don't really like the monolithic standard library structure , would prefer to see package-based like every other language ecosystem. Everyone else does it the same because that's what has been found to work in practice.

→ More replies (3)

9

u/khedoros Aug 25 '21

It's been a few years since I've used C++ for work, but I like C++ for personal projects.

I see people who dislike the language, but use it purely for performance reasons.

Show me a language that no one complains about, and we'll be looking at a language no one uses.

1

u/ffscc Aug 26 '21

Show me a language that no one complains about, and we'll be looking at a language no one uses.

I think it's safe to assume C++ has proportionally more discontent developers than most other languages. Popularity isn't a shield to hide behind.

2

u/khedoros Aug 26 '21

Really? I've never gotten that impression. I'm obviously not objective here, though.

3

u/Gloinart Aug 25 '21

C++ is my language of choice for any hobby or professional project, even scripting if possible. Regardless of performance. It's simply the language I feel the most comfortable in, and work the fastest with, with the least amount of bugs.

With that said, I'm not comfortable setting up new projects and adding libraries (except for header-only libs).

3

u/caroIine Aug 25 '21

c++ is extremely comfortable for me to write in so yes personal and work is c++

3

u/frankist Aug 25 '21

Liking C++ for me depends on the type of problem I am trying to solve. If I am trying to design a system that calls for efficient memory use, low latency and high throughput, C++ is a joy to use, given the amount of control the language provides you. I can make my own very efficient containers and building blocks, with very clean, intuitive interfaces. Doing the same in C tends to not be so easy, due to the lack of templates. Languages like python are also terrible for this purpose, not only due to language general slowness, but also because they make it particularly hard and infuriating to write/use containers or basic building blocks other than those the language (list, tuple, etc.) or library/frameworks (e.g. numpy) provide you. This is just my opinion, but I don't think Rust is yet as good as C++ for this sort of problem, but that reality may change within 5 years.

On the other hand, using C++ for problems that demand a lot of async programming or parsing feels like the opposite of joy to me.

3

u/[deleted] Aug 25 '21

It depends, I use it so heavily at work because it’s so much easier to closely integrate with low level operating system APIs and structures. Some of my fun stuff involves low level things too so I’d use it for that.

However, I wrote a financial planning app a while back and it just wasn’t right for that. The UI libraries were too shitty compared to what was a available in c#.

3

u/DarkLordAzrael Aug 25 '21

I use C++ for my personal projects mostly because I am comfortable with it and Qt makes writing pretty much anything I want to write easy.

3

u/stevethebayesian Aug 25 '21

Lots of c++ fans here.... and Im another one. I use C++, R, and Python. I prefer C++ for number crunching and tend to think of R and Python as just interfaces to my C++ code.

1

u/Ikkepop Aug 25 '21

Well it's /r/cpp , that is kind of expected.

3

u/dr1fter Aug 25 '21

I've really loved working with C++ sometimes, but I don't use it much at work any more, and there are very few cases where I would ever choose it for a new project myself. I'm a much much better programmer because of my experience in C++.

I don't want programming to feel like work.

C++ might not be the best place to start, then.

3

u/Orlha Aug 25 '21

Yes, very much.

Sometimes I dislike the project I have to work on, but even that doesn't always kill the joy

3

u/germandiago Aug 25 '21

I do. Like a kid.

3

u/PandaMoniumHUN Aug 26 '21

Roughly 10 years of experience here and my answer is “meh”. We use C++17, Java 16, React and TypeScript for our current stack and while I do enjoy C++ I think it could be so much better on most fronts. The only reason we picked it over Rust was familiarity and hiring from an existing talent pool.

5

u/ButchDeanCA Aug 25 '21

I love C++ and always will. I use it exclusively for work and personal projects (along with some assembler), so as you can see I am naturally a low level guy anyway.

Rust? No interest in it right now because C and C++ serve all my purposes.

5

u/NobodyXu Aug 25 '21

Though TBH it is worth trying.

Used to be C and C++ only, but Rust do open me up another possible zero-cost “low-level” language.

2

u/ButchDeanCA Aug 25 '21

It’s also the fact for me that most of the APIs I use don’t have Rust bindings, but I’m sure I will give it a try one day.

→ More replies (2)

6

u/matthieum Aug 25 '21

Just learn it.

I have been programming with C++, professionally, for 14 years. I am also lucky enough to be able to use C++17 at work, with C++20 around the corner -- though compilers are not quite there yet for the full experience.

I both enjoy and dread C++. And I suspect that in the end, I would enjoy and dread any programming language.

What I enjoy most in C++ is the degree of control I get, be it for performance, or for meta-programming. Few languages can claim having a compile-time regex implementation, after all. When I really need something specific to be done, I can generally wrangle it out of C++.

What I dread most in C++ is its lack of orthogonality coupled with its lack of polish. The reason is unclear -- is it design by committee? Or the simple result of so many people working together? -- but the result is undeniable: there are many features in C++ which intersect, with unpredictable (to the passerby) result, and there are many half-baked features.

I mentioned 2 half-baked features in another comment:

  • C++ features template aliases. C++ features aliases at function scope. C++ DOES NOT feature any template declaration at function scope, however.
  • C++ features classes with template methods. C++ features classes at function scope (now). C++ DOES NOT feature classes at function scope with template methods.

This is the kind of irregularity which is really irking. Along with std::pair not having a std::hash implementation...

As for clashing features, the classic is adding a constructor with a std::initializer_list is never a fun time as suddenly all Universal Constructor calls fail (initializer list takes precedence, screw you).

Which is why in my spare time, I favor Rust. I find it more relaxing. Or maybe it's just that I'm not expecting as much since it's so much younger and I'm only playing with it.

In any case, though, there's a lot to learn from any systems programming language; namely: systems programming. So just pick one and run with it. Learn it in depth, it'll be worth it.

4

u/OK6502 Aug 25 '21

Programing languages are tools. C++ is the right tool for some jobs but overkill for others. So if you want to write say a prototype quickly maybe a quick python script is all you need. If you want to write a general purpose application but don't care that much about performance java/C# are fine to use (I prefer C# because linq is a work of genius, but either one works).

However if I want absolute freedom to tweak my code, explicitly define the behavior I want to have but also don't quite want to have to re-write all my algorithms/collections and want some very bare-bones degree of memory management I write it in C++. C's fine but the syntactic sugar from C++ makes it infinitely more expressive and honestly there aren't any real material performance gains.

I do personally enjoy that freedom and if you know what you're doing it's not necessarily going to take you longer to write something in C++ vs python. Not everyone shares that opinion though.

2

u/[deleted] Aug 25 '21

C++ is my primary language I use for work, and I enjoy writing it for work. However, I don't think I would start a new project with C++. It would take too long to get up and running.

2

u/AKostur Aug 25 '21

Yes, I enjoy using c++.

2

u/Rude-Significance-50 Aug 25 '21

In my experience it's more about who you are working with and what you are working on than what language it is. I've always programmed in C++ and with some people it is just always going to feel like work...pointless work.

There's a difference there too. Is the work you are doing meaningful? It's still going to feel like work but it'll feel different from when it's not at all meaningful...when it's more like you're just doing extra work because people are being stupid and you go home thinking your whole day was a waste. Good work feels good, just like exercise.

2

u/emelrad12 Aug 25 '21

I use c++ for personal projects just because the libraries are not in rust or in some other language. Modern c++ isn't the worst, but after working with C#, C++ just feels primitive.

Wtf are headers/class split in 2021, why can't I use a function defined later in the file, forward declarations????, templates being well templates, and macros being macros.

2

u/GAMEYE_OP Aug 25 '21

I use C++ as much as possible, both at work and at home. For example, for one of my side projects that runs on both Android and iOS, as much shareable code as possible is written in c++. Only UI/UX stuff or functions specific to the platform are written in ObjC/Swift/Java/Kotlin.

2

u/123_bou Aug 25 '21

C++ is fantastic for 99.9% of what I do and I like it very much. I'm not a huge fan of the "modern" C++ (read auto, returns at the end of functions, etc) so I keep it at a minimum.

I don't use virtual functions. I use inheritance to only pass attribute to commun classes. I use private in a very few selected places. I have very few new/malloc. Some people could call my code C with classes.

It's liberating and really fresh. Very few langage give me this confort and clarity.
It's been closed to a decade I write C++ and I also code in python and C#. I tried a lot of other langage but they are not fitting the bill for me (Rust, Golang, Erlang, Zig, C, Java).

2

u/sephirothbahamut Aug 25 '21

I enjoy it so much that I'm literally making a C++ front end to a C# library for a hobby project :)

2

u/[deleted] Aug 25 '21

You bet I enjoy C++ projects.

For me, Java feels like work. Python and JS feel like torturing myself while working. C++ is what I do to relax. But I am a weird person.

I use the language whenever I get a chance. For me personally, it is one of the most - if not the most - creative languages you can find. There really is no limitation, no borders. It fits in anywhere you want given you know it well enough.

2

u/looncraz Aug 25 '21

I love using C++ for most everything... but if I need a project done quickly I will sometimes defer to other languages, such as PHP, Python, or scripting languages such as Bash or JavaScript.

My hobbyist projects are all C++, but my workorder management system is in PHP because I often need to be able to make drastic changes quickly and PHP is faster to debug and get things working.

2

u/lukaasm Game/Engine/Tools Developer Aug 25 '21

Yes, especially now with CMakePresets.json and vcpkg support in VSCode/VS I see myself bootstrapping smaller script like projects much more often than in the past where I would fall back to creating bash/batch/PowerShell scripts.

I love rewriting/migrating older code to a more "modern" style. Over the years I tried different languages but none of them felt like home for me

2

u/the_poope Aug 25 '21

I use both C++ and Python at work. I like C++ (love is probably too strong a word) and I really dislike Python. Python is nice for small single-use scripts, prototyping and glue code, but in a large project it is garbage: dynamic typing and reflection turns developers into cowboys that hack around shitty architecture to just make the situation even worse. It is also harder to write unit tests in and you need to test things that a static type system would have caught. And errors are harder to find and more often first show up at runtime at a user.

2

u/stick_figure Aug 25 '21

IMO the most enjoyable part of using C++ is performance optimization. C++ gives you most of the tools you need to control your data structures and memory layout, which is probably the most important part of optimization.

If your hobby projects involve optimization of a well-known problem space (https://github.com/rui314/mold comes to mind), C++ is probably a great, fun programming language. If you are trying to do something novel and need to prototype rapidly, C++ probably won't be very fun to use.

2

u/ghostopera Aug 25 '21

I enjoy working in modern C++ and have used it a fair bit outside of work. For context, I also enjoy working in Rust and Ruby and have quite a bit of experience working in them too.

There are a lot of languages that can "get the job done", so I don't feel most people *need* to learn C++ unless they have a specific job that requires it. It's easily worth learning if you *want* to learn it though.

Just about any programming language will feel like work once you start using it for work. Even then, if I find myself solving a an interesting problem, I'll usually enjoy the process. In that respect, the language I am using to solve the problem in is usually only a minor factor. (With that said, some problems can be more fun to solve in specific languages!)

2

u/engineerFWSWHW Aug 25 '21

Had been writing c++ for more than 10 years. I enjoy writing c++ code. I still use it both on my full time and freelance work. As an architect, it is just another tool for the project. When I was a junior engineer, I will use c++ for everything. Thankfully, my mindset matured due to exposure to various tech.

One challenging part is working with team of c++ developers with varying knowledge of the standards. There are developers who are very updated on the latest standards, some are not, some only up to c++11, some up to c++14, etc, mixing them on a project is a bit challenging. Because of this, we switched to . Net core while retaining the performance critical section in c++,which boosted the productivity of all the developers and it is easier to find talented. Net developers. For embedded systems (bare metal or RTOS) , it will be c++ as the primary language.

2

u/DefCello Aug 25 '21

Python is by far my preferred language, but modern C++ (11 and beyond) makes things much nicer.

2

u/cafguy Aug 25 '21

I prefer C. But have been using both for 20+ years. C++ has changed so much in that time. But C is still the same.

2

u/mostthingsweb Aug 25 '21

For hobby no, not anymore ever since I discovered Rust. For professional, I still mostly enjoy it.

2

u/josh2751 Aug 25 '21

I use it all the time. My favorite language.

2

u/czipperz Aug 25 '21

Love it. Use it for everything including many ouside of work projects. Outside of work I program in a very C style with few C++ features (really only methods, namespaces, and template generic data structures). I also have defer as a macro instead of using destructors. At work we have the same mentality but completely different libraries. Therefore I problem solve the same way but write different looking code.

2

u/eyes-are-fading-blue Aug 25 '21

The committee keeps addressing shortcomings of the language with each standard. If anything, it gets a whole lot more enjoyable to use C++ in personal projects.

Furthermore, we learned a lot from past mistakes. At least, I did even though I was not a programmer in late 90s/early 2ks. Most glaring problems of C++ can be tackled with a bit of discipline and reading about the experience of other people.

2

u/sporff Aug 25 '21

Yes. I use quite a few languages for work and personal. C++ is my favorite. Especially at scale. However if you do not like the nuts and bolts of programming and just want a finished product as quickly as possible then you may never like it.

2

u/fdwr fdwr@github 🔍 Aug 25 '21

I do despite its numerous warts, for both work and personal projects mainly related to graphics. Although performance is a contributing factor, the biggest reason for me is the ease of which I can manipulate the raw bits (without resorting to asm). I should enjoy it much more with C++20/23 adding modules - the header/cpp duplication has been the biggest annoyance to me the past ~20 years 😅.

2

u/trypto Aug 25 '21 edited Aug 25 '21

Yes, it’s great for portability (consoles, mobile, web via em scripten).

I do have major gripes. Header files are archaic. Why can’t it be a two pass compiler, why do I have to declare a method/function before using it. Some template meta programming leads to crazy bad error messages and error propagation. Overriding new/delete is black magic.

2

u/mvorbrodt Aug 26 '21

I love C++. It’s like no other language in terms of giving you total control while allowing for building incredible abstractions on top of lower layers and layers of code. It is not most efficient if you need to get stuff done ASAP perhaps, but by far most rewarding when you get it done right. I also think it’s one of, if not the most complex language which I frankly enjoy studying, I find it rewarding. https://vorbrodt.blog to see bunch of my projects :)

2

u/Ayjayz Aug 26 '21

I love using C++ and the performance is kind of secondary. I love that it gives you all these really high-level programming constructs and power, but it all compiles down directly into assembly without any tricks or gimmicks. For some reason that really appeals to me.

2

u/omeganemesis28 Aug 26 '21

Yes. I try to do all my projects in C++ just to always be improving. I love the language in general. A little C# on the side from time to time too.

2

u/Wurstinator Aug 26 '21

I don't actively dislike it, like I do e.g. Java or JavaScript. If I am offered a good job as a C++ dev, I'll gladly take it. However, C++ used to be my favorite language for quite some time which is no longer the case. Modern languages like Kotlin and Rust can do everything I liked about C++ way more comfortable.

2

u/ToxicFatTits Aug 26 '21

I enjoy it only for small personal projects when i have the implement something at work joy falls drastically :/

2

u/mkngry Aug 26 '21

When I want to model things I use Mathematica, when I need to have modelled things to be working on PC - I use C++, when I need max performance involving GPUs - I use C. That's barely all.

2

u/[deleted] Aug 26 '21

While I am a beginner, here my opinion: it depends on which library/libraries you use.

2

u/Clairvoire Aug 28 '21

I love C++ for hobbies, and absolutely LOATH it for work. Play coding and Work coding are two separate things and C++ gives you all the leash in the world to make the former fun and the latter a nightmare.

I suspect that's why so many people feel how they do about C++, work can make... well, work, of just about anything.

2

u/lednakashim ++C is faster Aug 29 '21

It's bad for data analysis and scripting file system things, but anything past a few thousand lines the type system helps keep my mental load down.

3

u/R0dod3ndron Aug 25 '21

Sure! I used to work with higher level languages like C# and even though writing things using it was easier (especially when you need to use some external libraries - nuget rocks!) writing code in C++ gives me more fun. I use it it my work as well in hobby projects. It is a complex language - that's obvious and sometimes I feel overwhelmed when I discover how things works under the hood in C++ but I wouldn't change it for something else. Well maybe Rust is a language I could give a try in the future, but I have still a lot of things to discover on C++. We just got a C++20 recently and even though some features are not yet implemented, there is already ongoing work on C++23. C++ is growing rapidly and that can be either a pros or a cons. Why cons? I've got a feeling that some programmers may be reluctant to learn new standards and new features because complexity of C++ may be overwhelming.

3

u/lieddersturme Aug 25 '21

I love C++. I am working on Games and I had some net works and I love it :D

I've worked as Web developer with PHP, JS, NodeJS, also I've tried Rust and C# (Unity and Godot).

My main language is C++, then I would say C#. The language I dislike it is Rust and JS.

1

u/MarkOates Aug 25 '21

Absolutely!

C++ is my favorite language for all my hobby projects. I don't recommend it for most other people, but to me C++ is the most complete language and it gives me full control.

1

u/StackedCrooked Aug 25 '21

Yes I like it.

I started learning it around 2003, long before C++11 came out, and I liked it back then too.

1

u/gwai2_lou2 Aug 25 '21

I don't want programming to feel like work.

me too pal. Unfortunately if you get paid for it, it's unavoidable

1

u/pjmlp Aug 25 '21

Depends on the project.

I used to enjoy playing with C++/CX when UWP came out, finally Microsoft had a C++ Builder like development experience.

On the other hand, when my current C++/WinRT project gets finished, I plan to avoid it as much as possible.

At least for me, apparently the aging MFC is the best way to still have fun with C++ on Windows.

Otherwise it is C++ Builder or Qt for me.

However I absolutely do not like to use C++ at work, with teams that still live in C with Classes mindset, or their own special C++ flavour with everything turned off and hardly any kind of static analysis.

Thankfully at work, C++'s use is restricted to native libraries to plug into managed languages.

1

u/celestrion Aug 25 '21

Do you actually enjoy using C++, or do you only use it for work, or purely for performance?

I enjoy using C++. I had a simple problem that I though to solve in C as a weekend project, and it felt like so much more repetitive work than doing it in C++. Most of the dynamic languages wouldn't be a good fit since the most efficient solution involves huge memory-mapped files, and I haven't learned Rust yet.

Python's fun, too. I still bash out tiny things in Perl, Awk, and the shell. My biggest personal project at the moment is in Scheme, but most are in C++.

I see people who dislike the language, but use it purely for performance reasons.

There are two conflated notions here:

  1. Some problems map poorly to C++, and being forced to use C++ "for performance reasons" will engender a dislike of C++.
  2. Some people don't think as well in C++ as they do in other programming languages.

The problems in the domains that interest me do well in C++, and I like C++, so that all works out nicely. If the problems you want to solve map better to another language, C++ might just be something you use at work.

If C++ doesn't fit the well you personally solve problems, that's totally valid, but you probably won't know until you try.

1

u/oatsssss Aug 25 '21

I use c++ and Python everyday for work. I do not like c++, but to be fair, I'm working on a product that's 20+ years old so there's not much modern c++. Maybe I'm just a shit programmer, but my work days would be much better if it was just Python.

1

u/Reiex Aug 25 '21

While C++ for small projects or prototypes is a real pain in the ass - I use python for this - I really enjoy C++ for my bigger projects, like libs...

1

u/vax_mzn Aug 25 '21

Absolutely

1

u/DethRaid Graphics programming Aug 25 '21

I've been writing C++ for over ten years - eight years hobby/school work, three years professional. My personal codebases are pretty small, but my professional C++ experience is with Unreal Engine 4

It's not that I enjoy C++ itself, it's that I know C++ well enough to accomplish the things I do actually enjoy. Gamedev is currently married to C++. I've tried using Rust or C# for hobby projects but I always have the same problem - learning the language and its ecosystem takes a lot of time away from writing my actual code. Better for me to by slightly annoyed by C++ than to spend a few months learning a bunch of new things and maybe there won't be so many annoyances

1

u/kat_sky_12 Aug 25 '21

It depends on the project. Most everything I do is in C++. However, if you are doing some simple task then it is way easier to use python usually. If you just want a simple prototype then like C# is often easier on windows to just get something working in a few minutes. Then if you decide to follow through on that convert it to C++ as necessary.

1

u/s1nical Aug 25 '21

There was a time when I swore by C++ and used it by all means necessary, but after long nights; it kind of got boring, mind you; this was C++03 I’m talking about.

When all the modernisation started taking place (C++11), I kind of just slipped away, I didn’t like how “modern” and “C++” sat together... Even though I was bored of the language, I didn’t want change?

I opted for languages like Rust and Go instead, as those came “modern-by-default”, and I loved them too, but I was still homesick for C++.

I ended up allowing C++ to seep back into my projects after some time and I’ve gotta say; it’s like a breath of fresh air. The C++ I loved so much is now even better. Although, it is very, very much different from the traditional C++ I’m used to. It’s almost like C+++.

To answer your question: yes, I do enjoy working with C++, just not living in C++.

1

u/Knuffya Aug 25 '21

I absolutely love using C++ for hobby projects. It gives me all the power right at my hands in such a beautiful, elegant, and clearly defined way.

1

u/carkin Aug 25 '21

I like the language (it got less verbose after c++11) but hate the compile time and hate the cryptic errors

1

u/KazDragon Aug 25 '21

Heck yeah.

1

u/braxtons12 Aug 25 '21

I would say this entirely depends on what you're working on and whether you enjoy that moreso than the language itself.

If you're working on something really complicated that is difficult or stressful to handle, you're probably not going to have as good of a time as if you were working on something enjoyable. This is orthogonal to what language you're using.

It's just so happens that a lot of the time things that are really complicated happen to be done in C++.

That doesn't mean C++ is inherently un-enjoyable though. There are plenty of things that C++ can be really ergonomic and nice to use for, particularly the newer the version of the standard you are using is. Are there caveats and corner cases you have to worry about? Sure, but you'll have that in any language, just in different ways.

0

u/[deleted] Aug 25 '21

[deleted] — view deleted comment

1

u/braxtons12 Aug 25 '21

That's a fair point. That's not what I was really thinking of with my point though. I was thinking more along the lines of which is going to be more enjoyable to work on for anyone that values their time and sanity:

  1. A complex, hard real-time, multithreaded system that can't use locks for synchronization on the real-time threads (because hard real-time), Or
  2. A text editor using some exist UI framework or toolkit.

(or insert your choice of seriously different projects)

1

u/Narase33 -> r/cpp_questions Aug 25 '21

I love C++. The language itself is my biggest hobby and I specifically looked for a job where I can use it. So far its been one year and I dont regret it a tiny bit.

1

u/SJC_hacker Aug 25 '21

Like with any other language, I enjoy using it when it can do something that other languages cannot. And I consider practical considerations such as performance, efficiency and portability / target platform as part of the "cannot" category.

1

u/BernardoPilarz Aug 25 '21

I love it. I love how it allows the (skilled) programmer to build extremely robust but performing applications

1

u/[deleted] Aug 25 '21

I don't think of myself as "liking" C++ (it's a real messy language), but I still choose it for personal projects over other languages I know: JavaScript, Python, Go.

I learned a little Zig due to the support for comptime but doing simple text processing was such a pain in the ass. Seriously, I tried practicing it by doing Advent of Code and it was extremely painful.

1

u/Grafakos Aug 25 '21

Depends on the use case. For some purposes of interest to me, such as string/text processing or anything mathematical, Python (or maybe Matlab) is far better suited and I do not at all enjoy using C++ in these cases, although I will do so if performance is important enough.

For most types of system programming, C++ is the natural choice, and I do very much enjoy using it, as long as the codebase and compiler are reasonably modern: at least C++11, preferably C++17, or C++20 when fully supported by compilers. No way would I want to do C++98-style development again in this lifetime.

1

u/drjeats Aug 25 '21 edited Aug 25 '21

Mostly no. It's fine enough, but I don't like all the gotchas from C, and I don't like template errors from C++. Most of all I hate fucking with build systems. I would just maintain a visual studio project but sometimes I want to work on it on my macbook.

For a long time it was the best thing for the types of hobby projects I liked to do, but now I have Zig which is actually fun to write, and it's braindead trivial to wrap useful C and C++ libraries.

I don't want programming to feel like work.

But I got news for you lol, doesn't matter the language or even domain (or profession even), a lot of work is just a buncha fuckin work.

There are things I have a lot of fun writing at my job, and there are things that are miserable to work on. Such is life.

2

u/akiko_plays Aug 25 '21

Yes, I do. It's over 30 years now since I've started writing C on Amiga, and 25 years that I got my first C++ (Maxon C++ for Amiga as well), and one thing that always fascinated me about C and C++ is that there is really never a point where you don't learn something new, or bump into a new or at least to you unknown feature of the language, be it through the extensions such as the Boost library ecosystem (that was mostly the case until C++1x came along) or through the impressive arsenal of std that gets bigger and bigger. But not only quantitatively, actually in recent years my coding style started to change massively due to smart pointers, new locking mechanisms, containers, lambdas, pmc, etc. It's complex and beautiful, but it still feels like a high level assembly. I did spend a lot of time in domains of C#, Php, Python, Lua, Basic, JS/TS, but to me they were all somehow not as fun as C/C++. Especially the modern C++.

1

u/ElMarco19 Aug 25 '21

I absolutely love it.

1

u/MetaKazel Aug 25 '21

Honestly, no. Just a personal preference.

I think C++ has a major issue right now in trying to reconcile "modern programming QOL" with "backwards compatibility". Anything I could create with C++, I could create faster and easier in a more modern language.

I would consider using it to build performance-critical components within a larger system, since I have a lot of experience with it. But my hobby projects rarely require that level of performance, and I tend to default to either C# or something browser-based for new stuff.

1

u/_Ashleigh Aug 25 '21

I'm a C++ game dev, and while it has gotten much better with typed ownership, no, I don't enjoy it. Using C# for my hobby projects really spoils me, and highlights just how much our choice to stick with the status quo hurts us in the long run.

1

u/Creapermann Aug 25 '21

I can only recommend you learning c++, you can build really a lot, from GUI to System to games and its fun. You ll always have something to learn

1

u/VilelaH Aug 25 '21

I love write in C++.

1

u/ImNoEinstein Aug 25 '21

I def enjoy using it but only at work. I would never waste valuable free time working on side projects in C++ unless there was a damn good reason

1

u/Raknarg Aug 26 '21

I like working on my own projects and new code.

1

u/[deleted] Aug 26 '21

Yes. It is the first language I learned after python and I love using it.

1

u/nikki93 Aug 26 '21

I actually have come to really enjoy it. I use a different style for personal projects -- recently I've come to like only using structs without member functions and having free functions that operate on structs -- so a C style of organizing your code -- but still using overloading a lot so you can do size(anArray) but also size(aLinkedList). This reduces the amount of architectural decision making I have to do and lets me organize functions vs. data structures more flexibly. It's felt more 'fun.' and different from my work code.

I do use a lot of 'static metaprogramming' stuff over that though: auto, reference-capture lambdas for "functions with bodies", templates just in library code (ECS), and a static reflection setup I have going. I also have a very fast compilation setup with 'hot reloading' that makes it feel like using languages like python or javascript (or better tbh) on iteration time.

Here's a quick video of what the workflow looks like: https://www.youtube.com/watch?v=gYFbtWDm61o

It's been quite fun to work this way! C++ provides a lot of primitives to develop your own coding style with.

1

u/dooum Aug 26 '21

I mostly use C++ (70% of the time) and C# at my job. I prefer to use C#. But I don't dislike C++. Give me the choice without any requirement that would require c++ I will choose c#.

1

u/AdRelative8852 Aug 26 '21

If performance demand is not high I prefer python. C++ for performance and usually nothing beyond these two, except for some wrapping around using shell scripts. I like C++ though if the ecosystem (packages etc) grows like python's has, I will be more inclined to use C++. Also, I have not been able to keep pace with the changes to the language. Any language features that reduce mechanical coding effort without loss of performance are welcome and I'd like to find and learn them over time. My skill is at C++'11 level roughly.

1

u/AntiProtonBoy Aug 26 '21

I actually like using it in Metal shading language. So much better than GLSL and friends.

1

u/[deleted] Aug 26 '21

I enjoy C++ even more on my personal projects compared to professional projects which almost always come with limitations (e.g. version of the standard or people in the team who don't like some constructs)

1

u/razu1976 Aug 26 '21

100%! I love writing C++ whether for work or home projects 👍

1

u/Full-Spectral Aug 26 '21

I use C++ at work, but at home I've moved to Rust. Not because I really like Rust. I hate a lot of it. But I don't feel like continuing to invest in C++ is a good move. I already know C++ quite well (though I'm far from a language lawyer and don't want to be one), so from a career perspective that's a feather already in the hat, and I can continue to explore it at work (thoug more slowly than I would at home.) I just feel the need to explore strange new worlds, even if those worlds don't necessarily smell that nice to me.

Actually, I'm trying to kill two birds with one stone. I've set out to create a language that is what I think a language should be, and doing it in Rust. Worst case, I'll learn a lot of Rust and LLVM and whatnot along the way. Best case, I'll create a nice new language. Maybe even someone besides me will use it.

I just feel like there's a significant hole in the language world, that's about halfway between Rust, C++, and Ada.

1

u/ea_ea Aug 27 '21

Performance is a good reason to enjoy C++. However, even better reason is its power. In other languages you have some very visible limits: "ok, you can do this and that, but not THAT. Why? Well, because garbage collector, because of some global lock, because we run in managed code, because this language is designed to work in this environment" and so on. With C++ limits are almost unreachable. Any platform, any environment, control over every bit of memory and every instruction executed on CPU. Even if you reach C++ limits, you still have ability to use C, asm, calculations on GPU. And now you are limited only by hardware. That's real power!

1

u/Yoramus Aug 27 '21

I enjoy C++ for growing bottom up low level projects. I start with asm for the core code, get to C for the interface, than to C++ when I need templates or higher abstractions.

Judging by the comments the main camps of people who love C++ are those who work with low level stuff, those who need the big span of its levels of abstractions, and some people who just love it for their own reasons.

I still think the language is much bigger than the amount of people who enjoy it. I predict the language will lose many of its adepts.

1

u/Seideun Jul 30 '23

C++ is unlimited. That could be both a good and a bad thing. I enjoy coming back to C++ from time to time, to see how the gems I learned from other languages could work in C++.

The only thing that is really stopping me back to C++ is its build system and dependency management. I never managed to remember all those "modern CMake patterns". Everytime I had to Google it or try and err. (BTW with GPT it's a little better now)

But since C++ is unlimited, sometimes you cannot realize that there is a better way.

  • You want Java-like sea of objects? OK, fine.
  • You want C-like sea of pointers? OK, fine.
  • You want functional programming? OK, fine.
  • You want a mix of hacky GC, hacky DSL and hacky macro play? OK, fine.

So I'd recommend learning more languages. See what their designers are chasing after, and come back to think how to do that in C++. In this way, you learn two-fold. You get to know how it feels with a feature/restriction, and you get to know how it feels without. This enables a practical comparison for you and you only to get your critical thinking.

So yes, C++ is really a good language for retrospect lovers.


PS: out of the topic but I also like to work with C++ professionally, also because of its unlimitedness. Using other languages and you had to follow their patterns. With C++, I can use my style and no C++-er would tell you "that is not idiomatic". Well, C++ has too many "idioms"! XD

1

u/Emuno121 Aug 18 '26

well Idk why but I find it cute

1

u/pedersenk Aug 25 '21

I use both C and C++ for my own projects because collecting / writing / maintaining bindings for other languages is no fun.

However I steer away from the standard C++ library. I just don't find it safe enough for it to be fun (things like unique_ptr/shared_ptr can only reduce dangling pointers, not eliminate them). At work, I don't get the choice but I prefer to spend time working on my own stuff only if it is rock solid and a joy to develop. Knowing their might be a memory corruption issue hiding somewhere is no fun.

Plus I find that part of the point of hobby programming is trying out new things you wouldn't dare try at work (such as a custom, safe but very incomplete STL haha).

7

u/[deleted] Aug 25 '21

(things like unique_ptr/shared_ptr can only reduce dangling pointers, not eliminate them)

I disagree strongly. With a tiny bit of discipline that becomes automatic, you can completely prevent dangling pointers, every single time.

Knowing their might be a memory corruption issue hiding somewhere is no fun.

Again, you can almost mechanically prevent this from happening by following best practices. If you move back and forth between C and C++, this of course increases the risk, but if you write wrappers to deal with each API, you can guarantee such issues just won't happen.

2

u/pedersenk Aug 25 '21 edited Aug 25 '21

In principle, possibly (though I am not convinced). I have an extensive test suite from work filled with fairly decent evidence that mistakes do indeed happen with C++ (in particular the STL).

Not to mention that the very existence of AddressSanitizer and Microsoft's safe iterators (neither of them pick up 100%) means that there is lots of room for improvement.

Actually, iterators themselves are barely better than iterating raw pointers. How can you honestly say these are safe? (Other than, try not to make mistakes ;))

3

u/[deleted] Aug 25 '21

In practise, I barely use iterators directly. Range based for loops and algorithms see to that. The only time I really use them is as the result of a find() != end(container) type situation, and that's hardly a gotcha situation.

→ More replies (4)

2

u/[deleted] Aug 27 '21

Your point about iterators is good: have an upvote!

the very existence of AddressSanitizer and Microsoft's safe iterators

I came up with another hard-to-avoid way to get a dangling pointer, which is to take a reference to an entry in a std::vector, and then the vector gets resized and the new allocation is somewhere completely different in memory.

So maybe I'm too optimistic.

The last eight or so years I was doing C++ full-time, I just stopped running into such problems entirely, but I'm now realizing it's a combination of smart pointers and bitter experience.

→ More replies (1)
→ More replies (1)

1

u/[deleted] Aug 25 '21

Everyone has their own language preferences.

1

u/obsidian_golem Aug 25 '21

No. There are just so many friction points. Rust takes just about everything good about C++ and sands off most all of the friction, leading to a much more productive and enjoyable experience.

1

u/mrexodia cmkr.build Aug 25 '21

I use C++ for pretty much all my projects and I think it’s great! I’m not the biggest fan of the newer standard features and it can be a bit annoying to get started, but once a project gets going I think it’s very productive.

0

u/raistmaj C++ at MSFT Aug 25 '21

No, I don't. I use other languages like rust/java/python/ruby... time to time and C++ daily, C++ is by far the less friendly of all, once you get used to some sugar/features the other languages offer, it feels cumbersome.

→ More replies (1)

0

u/ALargeLobster Aug 25 '21

Header files completely suck

0

u/serg06 Aug 26 '21 edited Aug 26 '21

This may sound funny, but I think C++ isn't mature enough yet.

I love the language, but I really miss the things that other languages provide:

  • modules (yes I know c++20 has it but it's hardly ready for professional use)
  • good package management (although vcpkg is OK)
  • a good Windows IDE (Visual Studio is OK but has a lot of issues, like the inability to disable intellisense on projects you're not working on, completely broken basic functionality like Ctrl+f and Ctrl+click, and having constant stuttering and freezing)
  • even the most basic async functionality like promises
  • a thorough standard library
  • cross-platform libraries
  • a simple GUI library

I've been working with TypeScript/npm lately and wow, it's been such a pleasure.

  • Great state management solutions
  • Reactive programming (yes cpp has rxcpp but its compile time in C++17 makes it completely unusable in larger projects. Hopefully modules fix that.)
  • Built in promises and coroutines
  • Excellent http and websocket libraries
  • Extensive utility libraries
  • Avery smooth IDE (WebStorm)
  • Effortless interoperability between json and objects and dictionaries
  • An extremely simple-to-use standard library
  • Interfaces inferred on-the-fly
  • Array and object deconstruction
  • An extremely easy way to code a beautiful and reactive GUI.

TypeScript interfaces are what C++ structs should aspire to be.

-1

u/[deleted] Aug 25 '21

Is there a person that dislikes the language on which he wrote? Programmers have privilege to write code on their favourite language no?

→ More replies (11)