this post was submitted on 25 Jun 2023
485 points (98.4% liked)

Programmer Humor

32710 readers
600 users here now

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

Rules:

founded 5 years ago
MODERATORS
 
top 33 comments
sorted by: hot top controversial new old
[–] [email protected] 32 points 2 years ago (1 children)
[–] [email protected] 24 points 2 years ago (4 children)

Also Linux: zombies, orphans

[–] [email protected] 10 points 2 years ago (1 children)
[–] [email protected] 4 points 2 years ago
[–] [email protected] 9 points 2 years ago

Meanwhile docker compose: --remove-orphans

[–] [email protected] 4 points 2 years ago

Don't forget fork!

[–] [email protected] 2 points 2 years ago

Just make sure you don't panic()

[–] [email protected] 29 points 2 years ago (2 children)
[–] [email protected] 17 points 2 years ago (2 children)

This is my favorite. I did php early in my career and for years I would have to Google " equivalent explode/implode" because it was so memorable

[–] [email protected] 5 points 2 years ago

Filthy barbaric PHP developers. It's Split() and Join().

[–] marcos 1 points 2 years ago

Even the php docs says it "splits" the string when it describes what it does.

It could be a good name for a function that turns a container or object into a lot of variables, but I don't remember php supporting multiple returned values.

[–] [email protected] 1 points 2 years ago

I loved explode back when I frequently used PHP

[–] [email protected] 27 points 2 years ago

I love die()! but PHP has exit(), too, and it does the same thing

[–] goodnessme 20 points 2 years ago (2 children)

C++ is actually std::exit(), exit() is C.

[–] [email protected] 2 points 2 years ago

Friends explained that to me, yeah. Oh well

[–] le_saucisson_masque 0 points 2 years ago

Technically isn’t there semicolon ?

[–] [email protected] 17 points 2 years ago (1 children)
[–] [email protected] 6 points 2 years ago (1 children)

Well I didn’t wake up today expecting to watch a video about task manager, but here I am.

[–] [email protected] 5 points 2 years ago

Now watching the Pinball video before going to bed.

[–] [email protected] 13 points 2 years ago (1 children)

php, the Dark Souls of the programming languages

[–] [email protected] 1 points 2 years ago (1 children)
[–] [email protected] 18 points 2 years ago (1 children)
[–] [email protected] 4 points 2 years ago

I heard the sound when I read this

[–] [email protected] 6 points 2 years ago (3 children)

I have never used System.exit() or sys.exit(). What is a use case where you would call these explicitly?

[–] [email protected] 27 points 2 years ago* (last edited 2 years ago)

For example if you want to set an explicit exit code. Calling python scripts will usually result in an exit code 0 after the script is run. If you want to set a different exit code for example 1 to indicate some error occured you can do that via sys.exit(1).

Same thing applies to other languages of course.

[–] [email protected] 6 points 2 years ago (1 children)

Applications where you aren't using some sort of framework. Usually MVC or other frameworks would handle this or are designed to continuously run.

[–] [email protected] 17 points 2 years ago

Perl is funnier, as these are valid ways of exiting with an exception:

readFile() or die;

die unless $a > $b;

[–] [email protected] 3 points 2 years ago

exit()-ing your step-sys already seems pretty explicit...

[–] [email protected] 5 points 2 years ago

Libdbus: Trying to remove a child that doesn't believe we're it's parent.

[–] amanaftermidnight 2 points 2 years ago

PHP is so bad even PHP wants to die().

[–] [email protected] 1 points 1 year ago

Fun fact: there's a shorter way to throw a NullPointerException:

throw null;

Because throw throws a NPE if the parameter is null

[–] qaz 1 points 2 years ago

Why not simply throw null?

[–] corroded 1 points 2 years ago

The proper way to do this in C is memset((void*)rand(), rand(), SIZE_MAX).

load more comments
view more: next ›