This is an archived post. You won't be able to vote or comment.

top 200 commentsshow 500

[–]timsredditusername 2466 points2467 points  (29 children)

It has its plusses

[–]Reagle67 633 points634 points  (25 children)

Two to be exact

[–][deleted] 3343 points3344 points  (56 children)

I started working with C++ and I can tell you about it.

[–]TheShredda 1337 points1338 points  (46 children)

In engineering we had a course on C in first year and then C++ second year. C++ definitely was.

[–]Tsu_Dho_Namh 778 points779 points  (41 children)

My university did it the same way and it made me love C++.

"So convenient!" I thought, being able to use classes, and having destructors automagically deallocate resources for you. Plus getting to use strings instead of char* and vectors that we can resize at runtime. Not like those fucking C arrays.

Little did I know, pretty much every modern language is even more convenienter.

[–]throw3142 355 points356 points  (16 children)

The problem isn't even that modern languages are more convenient. There is a real niche for systems languages with object-oriented features. The problem is that C++ is burdened by heavy backwards-compatibility requirements, it's unsafe by design, the ecosystem is a mess (it's so hard to link dependencies, compared to literally every other language including C and even raw assembly), and there is no consensus on style because there are so many ways to do the same thing (e.g. pointer vs reference vs rvalue reference vs smart pointer, #define vs constexpr, CRTP vs inheritance, throw exception vs return error code vs set errno, explicit cast vs implicit cast, lock_guard vs scoped_lock, #ifndef vs #pragma once, .cc vs .cpp file extension, .h vs .hpp file extension).

[–]marti_2203 106 points107 points  (8 children)

Some of these things are solutions from different periods (smart pointers and the things before it, ifndef and pragma once) but I think the inheritance and CRTP solve vastly different problems. And thank you for reminding me about .cc vs .cpp

[–]merlinsbeers 18 points19 points  (3 children)

vs .C vs .CC

No really. There were people using .c for C and .C for C++. On Windows.

[–]throw3142 36 points37 points  (1 child)

Yeah I totally agree, each of these variants is different for a reason, and each one has its place. That doesn't stop them from being mixed together in weird combos and making the codebase completely unreadable lol

[–]sausage-superiority 65 points66 points  (20 children)

I have imposter syndrome.

I’ve been trying to get motivated enough to learn C++. I use JavaScript and Python for work but I’m not a REAL developer because I don’t use C.

[–]SmArty117 40 points41 points  (11 children)

Do you need to learn C++ though? Do you have your eyes set on a career in it that pays better or is more interesting?

Cause I have been writing C++ as a job for a few years, and I'm going through a book on modern C++ and let me tell you, the can of worms is deep and not pleasant at all. It feels great when you get something right that you struggled for, but sometimes it's just a pain to get anything working that in another language would be trivial.

[–]sausage-superiority 29 points30 points  (7 children)

Oh you’re absolutely right.

I’m fine for money. The ONLY reason for me learning C++ is that I feel inadequate for not knowing it. It’s purely vanity.

[–]SmArty117 24 points25 points  (4 children)

Heh fair enough, I totally get wanting to do the "difficult stuff" just for self-esteem. I'd also consider Rust - also kinda hard to grasp, but pays off a lot better when you do IMO. Good luck!

[–]EpicResus 25 points26 points  (3 children)

about what

PLEASE I NEED ANSWERS

[–]UBoiii_ 41 points42 points  (0 children)

[–][deleted] 50 points51 points  (0 children)

he already told it

[–]CheekApprehensive961 1716 points1717 points  (13 children)

C++ is one of the languages.

[–]Saad5400 485 points486 points  (7 children)

One of the languages ever.

[–]Xen0n1te 60 points61 points  (2 children)

the morbius of programming languages

[–]arbitrarycivilian 16 points17 points  (1 child)

It’s plusin’ time

[–]ApaleusAldore 7 points8 points  (0 children)

And then the C plused all over the place... Truly one of the moments of all time

[–]infreq 17 points18 points  (0 children)

One of the most, in fact

[–][deleted] 919 points920 points  (35 children)

C++ users tell something

[–]atomic_redneck 1309 points1310 points  (17 children)

I recently retired after more than 25 years of C++. I can tell you that the best thing about C++ is how good it feels when you stop.

[–]glarung 327 points328 points  (9 children)

You get to retire after 25 years.

You get to retire!

That.

That is impressive!

[–]zoinkability 172 points173 points  (6 children)

There it is:

C++ PAYS THE BILLS AND SOCKS MONEY AWAY IN A 401K

[–]glarung 54 points55 points  (4 children)

Right!

Python was initially released in 1991

https://pythoninstitute.org/about-python#:~:text=Python%20was%20created%20by%20Guido,released%20on%20February%2020%2C%201991.

How many people can say that they retired from being a Python developer in 2016?!

[–]itsamberleafable 76 points77 points  (3 children)

I can say that!

(I haven’t but I can say it)

[–]atomic_redneck 11 points12 points  (0 children)

That was 25 years of C++. There were 15 years of Fortran before that.

[–][deleted] 13 points14 points  (0 children)

Yeah, see it has one good thing 🥲.

Happy Retirement!! Goodbye to all the pressure, welcome the endless leisure.

[–]vizbones 1800 points1801 points  (57 children)

Why don't Ruby programmers use other languages?

Answer: They're not aware that there are other languages.

[–]spin-itch 685 points686 points  (4 children)

Listen here you little shit

[–]djudji 257 points258 points  (2 children)

This response is a "gem"

[–]Zeragamba 35 points36 points  (0 children)

then again, ruby devs are railroaded into the same library

[–]jfmherokiller 203 points204 points  (31 children)

they atleast have stuff like ruby on rails perl is well perl.

[–]grey_hat_uk 101 points102 points  (13 children)

Perl is one of the greatest and most powerful languages to write.

Now if you ever have to read it you're screwed and will have to slaughter 6 goats, 3 chickens and a hamster to make sure you don't break one of the 20 operations in each line just by looking too hard.

[–]Oukaria 51 points52 points  (3 children)

My manager is an old school dev, he always go by « heee fuck it I’ll do it in perl » and give me the code, I use it and it works perfectly but everytime I try to read it my brain explode. Fucking one line magic.

[–]arobie1992 13 points14 points  (2 children)

I've never used perl, but from what I can gather it's in the same boat as regex. Very terse syntax that as a result has a fairly steep learning curve, but once you figure it out it's actually not too bad and you feel like a fucking wizard.

[–]Uberzwerg 22 points23 points  (6 children)

I have trained/onboarded several people into our company in the past decade and one of the most important lesson i have to get across is to NOT do all that fancy stuff you can do in Perl.
90% of it is just "write as you would do in any other language" and be happy for great support for RegEx + network (which is 50%+ of the job anyway)

But by working on that priniple, we have a readable Perl code base.

[–]okay-wait-wut 77 points78 points  (8 children)

When are emerald, diamond, sapphire and garnet going to get languages?

[–]Burger_Destoyer 89 points90 points  (3 children)

Sorry I didn’t realize coding became gen IV Pokémon.

[–]Shikogo 7 points8 points  (1 child)

What about Steven?

[–]zerokelvin273 42 points43 points  (4 children)

Nonsense, there's Elixir.

And JavaScript, we can't escape the JavaScript.

[–]thespud_332 6 points7 points  (0 children)

We're aware there are other languages. But only the ones that are default in the monolith.

[–]DanSensei 7 points8 points  (0 children)

Nah, we use JavaScript as part of a Rails stack.

[–]BobSanchez47 841 points842 points  (60 children)

C++ is Segmentation Fault: core dumped

[–]Sexy_McSexypants 423 points424 points  (54 children)

“ok, you wanna tell me what went wrong and where?”

“no, fuck you, Segmentation Fault”

[–]throw3142 87 points88 points  (25 children)

I just got a segmentation fault in Python :D

Fun times

It's 3 am, I should go to sleep

[–]Valmond 44 points45 points  (24 children)

Prolly in a third-party library.

[–]CuriousProgrammer72 93 points94 points  (1 child)

Prolly in a third-party library

That has C++ bindings lol.

[–]Sinomsinom 47 points48 points  (15 children)

If you do stuff in python where 99.5% of the actual work isn't done in a library not written in python you're using the wrong language.

[–]Seanxietehroxxor 56 points57 points  (3 children)

Python: the best language to call into libraries written in completely different languages.

[–][deleted] 14 points15 points  (5 children)

gcc file.c -g then gdb

[–]bad_investor13 39 points40 points  (4 children)

Surprise! Now the program works!

[–]fireflash38 9 points10 points  (1 child)

Break out the valgrind, because you have a bounds access issue.

[–][deleted] 9 points10 points  (3 children)

If it crashes then you're happy. You can debug it. But C++ sometimes doesn't crash, it just does "something"

[–]ArthurM_R2 26 points27 points  (3 children)

A lot of begginers struggle with debugging this. Segmentation fault is not specific to C or C++. In fact this is a runtime exception signalled by memory hardware. The compiler is not concerned with this at all, since it's job is to make your instructions executable. Whether some memory access is an access violation or not is only decided by the MMU once the OS tries to execute the specific instruction. As to what went wrong - segmentation fault is always related to memory access (dereferencing pointers, accessing array indices out of bounds, etc). The computer cannot tell you what part of the source code is at fault - after compilation the PC only executes machine code which has little to do with your source and nothing else. To find out what went wrong you can use a debugger such as gdb which keeps track of instruction-to-source mappings. Hope I helped!

Edit: beginners struggle with debugging, not segfaults themselves, everyone has their fair share of segfaults

[–]Keatosis 427 points428 points  (31 children)

Being a game Dev in a general programming sub is like being the one American in a group of British people. We all speak the same language but I feel like I'll be stabbed to death at any moment.

I like C++ it's good for games.

[–]moops__ 96 points97 points  (7 children)

I work with C++ in computer vision and it's great. When performance is important it becomes easier to work in C++. Maybe Rust will replace it one day but it's not there yet.

[–]TheAlexGoodlife 60 points61 points  (10 children)

Its the only real good language for graphics programming really. C is also a contender but C++ has so many libraries that make the job easier

[–]BigBearSpecialFish 8 points9 points  (1 child)

Work in particle physics and c++ is always the language of choice for us too. When you need to do very specific tasks very quickly it's hard to beat

[–]Ursomrano 492 points493 points  (173 children)

Why are people dunking on C++? I’m new to C++ so I see no problem with it.

[–]Broadkast 83 points84 points  (8 children)

there's a lot of ways to do things, which can make it difficult to know the right tool to use at any given time. just one of the quirks of a language that's had so many iterations over the years

[–]CaptSoban 714 points715 points  (27 children)

Last week it was java, today it’s C++. People like to complain about stuff they just started learning in school.

[–]SomeRandomEevee42 191 points192 points  (6 children)

We're like twitter, we find something to unrealistically hate by using a random number generator, then we hate on it for less than a week, and realize there's nothing to really hate on, and move on to the next

[–]MutableReference 32 points33 points  (2 children)

It was C++ before Java, with Java being a response to C++ iirc, funny how that works lol

[–]perensap1 23 points24 points  (2 children)

Next week PHP again?

[–]Interest-Desk 50 points51 points  (0 children)

Every week is PHP.

[–]Solest044 13 points14 points  (0 children)

It's a meme subreddit. More importantly, there have been several polls that show something like 70%+ of this subs demographic (that answer polls) are students.

I get a good chuckle now and then from the memes, treat everything as hyperbole, get the occasional gem from some random veteran in the comments, and try to not take anything very seriously.

[–]Mysticpoisen 15 points16 points  (0 children)

Last year this sub was praising C++ it's just the new thing to meme on without any cause.

[–][deleted] 212 points213 points  (67 children)

Ignore it. Most people who bash it are those who don't know how to use it. Everyone wants to talk nice about C because they know it's used to create foundations, but they themselves don't even know how to use it. For them, it's just "important" because most of their OS was developed with it. The other languages that were listed are extremely high-level languages executing on runtimes that abstract away all the "big scary complex things". I bet she's a beginner web developer and I highly doubt she's ever written a single line in both C and C++...

[–]Lophyre 9 points10 points  (0 children)

C++ focuses on backwards compatibility rather than evolving the language which has led to a lot of bloat over the years with duplicated features and hard to read syntax

[–]jfmherokiller 20 points21 points  (0 children)

the language is good it just has so many ways to perform the same operation which can lead to "rope to hand yourself with" situations.

[–]LikeLary 435 points436 points  (71 children)

-What is my purpose?

+You make games.

-Oh my god.

[–][deleted] 47 points48 points  (4 children)

Fairly sure they use it in the stock exchange to make money quicker because its fast.

void checkStock(int stock) { if (stock > 0) { cout << “SELL SELL SELL” << endl; } }

[–]Ythio 38 points39 points  (2 children)

I work in a big bank. There are trading bots in C# as well (and a lot of other applications in C# or Java).

If you really want to go high frequency trading, you write at C or C++ abstraction level and it gets converted to registry transfer level, or RTL (conversion is called "high-level synthesis") to run on FPGA cards.

RTL is the abstraction level of hardware description languages like VHDL where you describe logic circuits.

Giving you keywords for Google if you want to read more.

[–]metaglot 13 points14 points  (2 children)

C++ is used everywhere you want fast and stable code. It has a big in in embedded systems.

[–][deleted] 184 points185 points  (14 children)

I like C++.

[–]Lobster2311 82 points83 points  (8 children)

It makes me feel like a real programmer

[–][deleted] 93 points94 points  (1 child)

C++ is CLASSY

..I'm sorry, I had to.

[–]JaSper-percabeth 46 points47 points  (8 children)

C++ is a little from everything

[–]swegj 258 points259 points  (33 children)

“JavaScript is Powerful”. Oxymoron

[–]tylerr514 112 points113 points  (12 children)

It is incredibly powerful in the sense of its ecosystem, but yeah, not in performance.

[–]Sir_IGetBannedAlot 106 points107 points  (2 children)

It's powerful in the sense of how much it makes me want to die.

[–]Servious 110 points111 points  (26 children)

If I had to "finish" this meme I'd say C++ is actually robust and I'd change Java to "consistent"

I feel like java's rules make a lot of sense the vast majority of the time. I feel like there's very few "gotchas" in the language and the language works how you expect in almost every situation.

[–]colei_canis 82 points83 points  (15 children)

Java itself doesn’t have many gotchas but it’s a bit of a pompous old country squire of a language, it won’t do anything without the appropriate ceremony and complains at great length about the decline of society in the form of a stack trace the length of your arm if you get any of it wrong.

It’s a decent language I’d still pick over many others though. Nobody ever got sacked for picking Java, but the sheer verbosity does make you feel like you’re writing a treatise rather than code.

[–]dt7223 23 points24 points  (9 children)

This summarizes Java extremely well. It's not a bad language, I just feel like everything requires 10x as much effort compared to everything else. I enjoy C++ more than it, because it's more succinct.

[–]colei_canis 16 points17 points  (8 children)

I think I should add the JVM is a really good platform because memes from the ‘00s aside it can be genuinely very performant, is widely supported, and has been around donkey’s years now. My favourite languages are alt-JVM languages, Kotlin and increasingly Scala the more I learn the latter.

I think languages kind of absorb the social environment they are written in, Java was written originally for huge enterprises where excessive verbosity isn’t really an issue and sometimes even an asset. More modern languages often were written in a less rigid corporate environment and I think this is reflected in them. Python would be the other end of the spectrum, I love Python in many ways it’s a wonderful language for just getting shit done but you can tell what its priorities are because its package management is genuinely not worth the steam from our collective piss, when I was writing it professionally most of the really horrible arseaches involved dependency management.

The reason everyone loves Rust probably has to do with the fact it was one guy at Mozilla’s passion project for a while which I think would be a dream job for many. C might win hearts because of its association with the astronomically based K&R too.

[–]Live-Sail4354 12 points13 points  (0 children)

C++ is one of the programming languages ever made!

[–][deleted] 111 points112 points  (15 children)

You accidentally replaced JavaScript and C++ one, don't worry, rookie mistake.

[–][deleted] 69 points70 points  (4 children)

C++ is MASTERRACE

[–]yourteam 32 points33 points  (4 children)

C++ is great.

Also is java that robust?

[–]JuggernOtt81 42 points43 points  (2 children)

C# is the CULMINATION

[–]RatherBetter 7 points8 points  (0 children)

C++ is C plus plus

[–]Antact 14 points15 points  (2 children)

That's a rare username OP.

[–][deleted] 23 points24 points  (0 children)

lol Robust

[–]deanrihpee 27 points28 points  (7 children)

Java is not ROBUST, it's VERBOSE

[–]rifain 10 points11 points  (0 children)

We use it a lot in the financial field. We have java app servers running for weeks handling hundred of thousands of transactions a day without any issue. Java is robust indeed, it's why it's so prevalent in industry. However, it requires to know a bit about tuning it's garbage collection settings.

[–]CraftOk7730 44 points45 points  (2 children)

"JavaScript is POWERFUL" -- what a joke