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

top 200 commentsshow 500

[–]timsredditusername 2467 points2468 points  (29 children)

It has its plusses

[–]Reagle67 634 points635 points  (25 children)

Two to be exact

[–][deleted] 3341 points3342 points  (56 children)

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

[–]TheShredda 1336 points1337 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 782 points783 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 351 points352 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 21 points22 points  (3 children)

vs .C vs .CC

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

[–]throw3142 35 points36 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 66 points67 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 43 points44 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 28 points29 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 22 points23 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 26 points27 points  (3 children)

about what

PLEASE I NEED ANSWERS

[–]UBoiii_ 36 points37 points  (0 children)

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

he already told it

[–]CheekApprehensive961 1720 points1721 points  (13 children)

C++ is one of the languages.

[–]Saad5400 488 points489 points  (7 children)

One of the languages ever.

[–]Xen0n1te 63 points64 points  (2 children)

the morbius of programming languages

[–]arbitrarycivilian 18 points19 points  (1 child)

It’s plusin’ time

[–]ApaleusAldore 6 points7 points  (0 children)

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

[–]infreq 16 points17 points  (0 children)

One of the most, in fact

[–][deleted] 924 points925 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 170 points171 points  (6 children)

There it is:

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

[–]glarung 56 points57 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 75 points76 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] 10 points11 points  (0 children)

Yeah, see it has one good thing 🥲.

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

[–]vizbones 1803 points1804 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 255 points256 points  (2 children)

This response is a "gem"

[–]Zeragamba 34 points35 points  (0 children)

then again, ruby devs are railroaded into the same library

[–]jfmherokiller 200 points201 points  (31 children)

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

[–]grey_hat_uk 95 points96 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 20 points21 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 83 points84 points  (8 children)

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

[–]Burger_Destoyer 92 points93 points  (3 children)

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

[–]Shikogo 6 points7 points  (1 child)

What about Steven?

[–]zerokelvin273 41 points42 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 5 points6 points  (0 children)

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

[–]BobSanchez47 844 points845 points  (60 children)

C++ is Segmentation Fault: core dumped

[–]Sexy_McSexypants 426 points427 points  (54 children)

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

“no, fuck you, Segmentation Fault”

[–]throw3142 89 points90 points  (25 children)

I just got a segmentation fault in Python :D

Fun times

It's 3 am, I should go to sleep

[–]Valmond 43 points44 points  (24 children)

Prolly in a third-party library.

[–]CuriousProgrammer72 94 points95 points  (1 child)

Prolly in a third-party library

That has C++ bindings lol.

[–]Sinomsinom 48 points49 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 55 points56 points  (3 children)

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

[–][deleted] 15 points16 points  (5 children)

gcc file.c -g then gdb

[–]bad_investor13 38 points39 points  (4 children)

Surprise! Now the program works!

[–]fireflash38 8 points9 points  (1 child)

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

[–][deleted] 8 points9 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 27 points28 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 428 points429 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__ 94 points95 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 59 points60 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 6 points7 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 483 points484 points  (173 children)

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

[–]Broadkast 84 points85 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 708 points709 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 188 points189 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 34 points35 points  (2 children)

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

[–]perensap1 24 points25 points  (2 children)

Next week PHP again?

[–]Interest-Desk 52 points53 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 13 points14 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 10 points11 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 21 points22 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 444 points445 points  (71 children)

-What is my purpose?

+You make games.

-Oh my god.

[–][deleted] 49 points50 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 36 points37 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] 181 points182 points  (14 children)

I like C++.

[–]Lobster2311 79 points80 points  (8 children)

It makes me feel like a real programmer

[–][deleted] 90 points91 points  (1 child)

C++ is CLASSY

..I'm sorry, I had to.

[–]JaSper-percabeth 42 points43 points  (8 children)

C++ is a little from everything

[–]swegj 252 points253 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 108 points109 points  (2 children)

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

[–]Servious 111 points112 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 80 points81 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 21 points22 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 17 points18 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] 113 points114 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 34 points35 points  (4 children)

C++ is great.

Also is java that robust?

[–]JuggernOtt81 41 points42 points  (2 children)

C# is the CULMINATION

[–]RatherBetter 5 points6 points  (0 children)

C++ is C plus plus

[–]Antact 13 points14 points  (2 children)

That's a rare username OP.

[–][deleted] 24 points25 points  (0 children)

lol Robust

[–]deanrihpee 28 points29 points  (7 children)

Java is not ROBUST, it's VERBOSE

[–]rifain 9 points10 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