Personally I prefer `throw new nullpointerexception`

486 points · 34 comments · view on lemmy.world

34 Comments

nothacking@discuss.tchncs.de · 32 pts · 3y (6 replies)

Linux: kill

chris_hayes@lemmy.ml · 24 pts · 3y (5 replies)

Also Linux: zombies, orphans

Mirodir@lemmy.fmhy.ml · 10 pts · 3y (1 reply)

Daemons

name_NULL111653@pawb.social · 4 pts · 3y

Crypt

ehrenschwan@feddit.de · 9 pts · 3y

Meanwhile docker compose: --remove-orphans

russjr08@outpost.zeuslink.net · 4 pts · 3y

Don't forget fork!

dmxk@lemmy.ml · 2 pts · 3y

Just make sure you don't panic()

dullbananas@lemmy.ml · 29 pts · 3y (4 replies)
epyon22@sh.itjust.works · 17 pts · 3y (2 replies)

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

TwilightKiddy@programming.dev · 5 pts · 3y

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

marcos@lemmy.world · 1 pts · 3y

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.

curiosityLynx@beehaw.org · 1 pts · 3y

I loved explode back when I frequently used PHP

yaniv@lemmy.ml · 27 pts · 3y

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

goodnessme@lemmy.world · 20 pts · 3y (2 replies)

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

GandhiTheDerg@pawb.social · 2 pts · 3y

Friends explained that to me, yeah. Oh well

le_saucisson_masque@lemmy.world · 0 pts · 3y

Technically isn’t there semicolon ?

Grishaix@feddit.de · 17 pts · 3y (2 replies)

MS Developers: Kill all children

ndguardian@lemmy.studio · 6 pts · 3y (1 reply)

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

Grishaix@feddit.de · 5 pts · 3y

Now watching the Pinball video before going to bed.

kr0n@lemmy.ml · 13 pts · 3y (3 replies)

php, the Dark Souls of the programming languages

phoenixz@lemmy.ca · 1 pts · 3y (2 replies)

Because?

dandroid@dandroid.app · 18 pts · 3y (1 reply)

Y O U D I E D

flashgnash@lemm.ee · 4 pts · 3y

I heard the sound when I read this

lowleveldata@programming.dev · 6 pts · 3y (4 replies)

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

niq@discuss.tchncs.de · 27 pts · 3y

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.

epyon22@sh.itjust.works · 6 pts · 3y (1 reply)

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

jsveiga@vlemmy.net · 17 pts · 3y

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

readFile() or die;

die unless $a > $b;

name_NULL111653@pawb.social · 3 pts · 3y

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

JebanuusPisusII@szmer.info · 5 pts · 3y

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

amanaftermidnight@lemmy.world · 2 pts · 3y

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

silenium_dev@etaorion.org · 1 pts · 3y

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

throw null;

Because throw throws a NPE if the parameter is null

corroded@lemmy.world · 1 pts · 3y

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

qaz@lemmy.world · 1 pts · 3y

Why not simply throw null?