this post was submitted on 29 Aug 2024
922 points (97.7% liked)

Programmer Humor

32415 readers
380 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
top 47 comments
sorted by: hot top controversial new old
[–] tetris11@lemmy.ml 56 points 2 months ago (1 children)

It's amazing what modern game engine's can render. That looks almost real, kudos to the creators

[–] stupidcasey@lemmy.world 9 points 2 months ago (1 children)

It’s fine but have you seen starfield?

[–] tetris11@lemmy.ml 10 points 2 months ago (1 children)

*chef's kiss, followed by vomiting*

[–] kautau@lemmy.world 13 points 2 months ago (1 children)
[–] tetris11@lemmy.ml 8 points 2 months ago

That looks almost real, kudos to the nightmare machine creators

[–] pelya@lemmy.world 34 points 2 months ago (1 children)

C++ is fiiiiine. Just use the modern variant of the language, don't bother with hand-optimizing your memory allocators, and generally avoid anything involving pointer arithmetics. So, basically, use it like you would use Python.

[–] raspberriesareyummy@lemmy.world 10 points 2 months ago (2 children)

So, basically, use it like you would use Python.

That's a great way to get performance as shitty as python's.

[–] zik@lemmy.world 42 points 2 months ago (3 children)

C++ can do a lot of things but one thing it can't do is perform as poorly as python.

[–] nexussapphire@lemm.ee 5 points 2 months ago
[–] raspberriesareyummy@lemmy.world 4 points 2 months ago

Not quite, but smart pointers in the wrong location can be quite wasteful in terms of CPU cycles.

[–] thebestaquaman@lemmy.world 16 points 2 months ago (1 children)

This is a very "yes but still no" thing in my experience. Typically, I find that if I write "naive" C++ code, where I make no effort to optimise anything, I'll outperform python code that I've spent time optimising by a factor of 10-30 (given that the code is reasonably complex, this obviously isn't true for a simple matrix-multiplication where you can use numpy). If I spend some time on optimisation, I'll typically be outperforming python by a factor of 50+.

In the end, I've found it's mostly about what kind of data structures you're working with, and how you're passing them around. If you're primarily working with arrays of some sort and doing simple math with them, using some numpy and scipy magic can get you speeds that will beat naive C++ code. On the other hand, when you have custom data structures that you want to avoid unnecessarily copying, just rewriting the exact same code in C++ and passing things by reference can give you massive speedups.

When I choose C++ over python, it's not only because of speed. It's also because I want a more explicitly typed language (which is easier to maintain), overloaded functions, and to actually know the memory layout of what I'm working with to some degree.

[–] raspberriesareyummy@lemmy.world 5 points 2 months ago

I guess I should have clarified in my original comment that I was exaggerating - obviously, C++ doesn't get as bad as python, not even into the same ballpark.

My emphasis was on "don't use C++ like you would python" because that's not good advice imo.

[–] _____@lemm.ee 30 points 2 months ago (1 children)

I love C++ I love C++ I love C++ I love C++

>does big something with C++

I hate C++ I hate C++ I hate C++ I hate C++

[–] wizardbeard@lemmy.dbzer0.com 5 points 2 months ago

Honestly that's most things in life.

The more complex your project, the more likely you are to run into the rough patches or quirks of whatever it is you're working with.

[–] QuincyPeck@lemmy.world 19 points 2 months ago (2 children)

I also enjoyed this album by Incubus.

[–] InvertedParallax@lemm.ee 7 points 2 months ago (1 children)
[–] finley@lemm.ee 6 points 2 months ago (2 children)
[–] EleventhHour@lemmy.world 4 points 2 months ago (1 children)

A Momentary Lapse of Reason

[–] finley@lemm.ee 4 points 2 months ago* (last edited 2 months ago) (1 children)
[–] hudson@sh.itjust.works 4 points 2 months ago (1 children)
[–] EleventhHour@lemmy.world 2 points 2 months ago (1 children)
[–] deathmetal27@lemmy.world 1 points 2 months ago
[–] ibasaw@lemmy.world -1 points 2 months ago
[–] 0ops@lemm.ee 1 points 2 months ago

What programming language is Afungus Amongus?

[–] Seraph@fedia.io 18 points 2 months ago (1 children)

It's so we can recreate that, but with like laser beams and stuff.

[–] electricprism@lemmy.ml 7 points 2 months ago (1 children)

When you first saw C++ were you blinded by its majesty?

[–] nickwitha_k@lemmy.sdf.org 2 points 2 months ago

(with lasers): "How about now?"

[–] jeff@programming.dev 17 points 2 months ago

My favorite project was C++; it was big, it was complicated, there was a massive team working on it, I got to work with high level abstractions while occasionally dealing with really low level concerns.

It was really hard, but now writing code in every other language I've worked in has been really easy.

[–] merthyr1831@lemmy.ml 16 points 2 months ago (1 children)

I feel the same every time I see JavaScript. C++ is one of those ugly but also elegant languages you should try at least once.

[–] CanadaPlus@lemmy.sdf.org 8 points 2 months ago* (last edited 2 months ago)

You know, in that case, the blame doesn't fall on the guy that made it. Shit on the people that made the development deadline a couple weeks, and then decided to keep the product in place for decades.

[–] Psythik@lemmy.world 13 points 2 months ago

The people who invented C++ never went outside, otherwise they would have never invented C++.

[–] milicent_bystandr@lemm.ee 12 points 2 months ago

What if we didn't want more sea, just spikier? C#

I look out acroth the thea, and thee what I can thee. I can't pronounth that thtupid language; I'll write in lithp.

Ocean + traversing a desert => Ocaml?

I improved the C! It is greater! More potent! But what is this? I look at at my poor boat, upon which I traverse the waves of the C++ 7; now it is degraded. Now its beautiful metal hull has oxidised. Oh, the dangers of the C. ...Wait, that gives me an idea...

[–] affiliate@lemmy.world 7 points 2 months ago

and then they had the audacity to put that picture on the cover of the textbooks

[–] CodexArcanum@lemmy.world 7 points 2 months ago (1 children)

That's why Rust had to be developed! Oxidize all those computers and stuff back to nature.

[–] CodexArcanum@lemmy.world 5 points 2 months ago

What's with the downvotes on a silly joke? Is the Linux kernel team on Lemmy?

[–] Fixbeat@lemmy.ml 6 points 2 months ago

Yes, a perfect thing of beauty.

[–] HStone32@lemmy.world 5 points 2 months ago (1 children)

its even worse that they hat to ruin a beautiful existing language to do it.

[–] milicent_bystandr@lemm.ee 5 points 2 months ago (1 children)
[–] Chadus_Maximus@lemm.ee 3 points 2 months ago (1 children)
[–] CanadaPlus@lemmy.sdf.org 2 points 2 months ago* (last edited 2 months ago)

Burn the heathen.

Sorry, I mean

START PROGRAM BurnTheHeathen
Burn&
the heathen !.
END PROGRAM

/s

[–] xilliah@beehaw.org 3 points 2 months ago

Directx 9000

[–] Sam_Bass@lemmy.world 1 points 2 months ago

The issue is not aesthetic. It is that the feel doesnt match up to the look

[–] AnnaFrankfurter@lemmy.ml -2 points 2 months ago (1 children)
[–] leo85811nardo@lemmy.world 5 points 2 months ago (1 children)

What's wrong with embedded C? Would you rather write assembly?

[–] AnnaFrankfurter@lemmy.ml 1 points 2 months ago* (last edited 2 months ago) (1 children)

Hey assembly is good in the sense you are only dealing with one language but in embedded C you get bad parts of both C and assembly. You have to follow weird C99 or even C89 syntax and on top of that for each micro controllers you have to sift through several hundred pages of data sheet. Each one needing separate registers to be setup in a particular way for every single operation and so much more stupid ass shit.

[–] leo85811nardo@lemmy.world 2 points 2 months ago* (last edited 2 months ago)

All of the quirks you said are true, yet they still established the "okay" ecosystem of hobby-grade microcontrollers like Arduino, IoT devices, and other small scale robotics systems. None of them would have happened without the "okay" abstraction C/C++ provides as opposed to assembler