this post was submitted on 18 Jan 2024
719 points (98.5% liked)

Programmer Humor

19529 readers
381 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
top 50 comments
sorted by: hot top controversial new old
[–] [email protected] 191 points 9 months ago (6 children)

I propose a new, more threatening kind of control flow.

do {
  /* something */
} or else {
  /* you don't want to find out */
}
[–] gex 57 points 9 months ago (6 children)

Some C++ style guides suggest the following naming convention for functions that crash on any error

OpenFileOrDie()
[–] [email protected] 26 points 9 months ago (4 children)

PHP has the always wonderful (and perfectly functional) syntax of

logUserIn() or die();

load more comments (4 replies)
[–] [email protected] 10 points 9 months ago (1 children)

Personally, I like to call catched exception variables up, so for a rethrow I can throw up;.

load more comments (1 replies)
load more comments (4 replies)
[–] [email protected] 38 points 9 months ago

this is just a menacing try/catch!

[–] [email protected] 18 points 9 months ago

It_would_be_a_shame_if(condition)

load more comments (3 replies)
[–] [email protected] 99 points 9 months ago (3 children)

Please God let this be a humorous post that somehow does not also find a way to manage to come true...

[–] [email protected] 84 points 9 months ago* (last edited 9 months ago) (2 children)

I would have bought it if they said ifnot instead, it's the same number of characters and wouldn't require a major parser overhaul to support keywords with a ' in the name.

[–] [email protected] 40 points 9 months ago (1 children)

i mean, “unless” tends to be the usual term for an “if not” keyword in languages that implement such a thing

[–] [email protected] 20 points 9 months ago (4 children)

Which is awful and incredibly confusing. I hate ruby

load more comments (4 replies)
[–] [email protected] 13 points 9 months ago (2 children)

Yeah, to be clear, I don't like it, I don't like it one bit:-P.

load more comments (2 replies)
load more comments (2 replies)
[–] bappity 98 points 9 months ago* (last edited 9 months ago) (1 children)
[–] [email protected] 45 points 9 months ago* (last edited 9 months ago)

nocap(frfr){

}

[–] [email protected] 70 points 9 months ago (4 children)

Reduce exclamation marks!? Great Scott!!!!! Is there a shortage of punctuation in the future!?

[–] [email protected] 19 points 9 months ago

You could have saved two, all you had to do was use the interrobang. You’re a monster.

[–] jaybone 13 points 9 months ago
[–] [email protected] 11 points 9 months ago

All known deposits were depleted

load more comments (1 replies)
[–] ohlaph 53 points 9 months ago (3 children)
aint (something) {
    somethingElse()
}
load more comments (3 replies)
[–] lung 41 points 9 months ago (1 children)
[–] [email protected] 40 points 9 months ago (1 children)

I believe that resolves the same as

ain't!(!untrue)

[–] [email protected] 35 points 9 months ago (2 children)

Still not as good as whence

[–] [email protected] 14 points 9 months ago (4 children)

Is this a reference to something because I’d love to read it if you have a time to share.

load more comments (4 replies)
load more comments (1 replies)
[–] [email protected] 35 points 9 months ago* (last edited 9 months ago) (3 children)

Why not just ifnot? Same count of characters but an o instead of a possibly problematic single quote.

[–] [email protected] 19 points 9 months ago

I think it's just capitalizing on a trend to add n't to otherwise noy contractions, to make them into contractions. Contractionn'ts, if you will

[–] [email protected] 15 points 9 months ago* (last edited 9 months ago)

Yes... how is "reducing exclamation marks" a good thing when you do it by adding a ' (not to be confused with , ´,or’` ..which are all different characters).

Does this rely on the assumption that everyone uses a US QWERTY keyboard where ! happens to be slightly more inconvenient than typing '?

[–] KmlSlmk64 13 points 9 months ago (1 children)

If someone really wanted to add it, probably the best would be to use unless

[–] JoshuaEN 8 points 9 months ago (1 children)

I really liked having unless in Ruby; a ! can be easy to miss, while unless made it clear without needing to write out != true.

load more comments (1 replies)
[–] [email protected] 29 points 9 months ago (2 children)

"Help's with readability"? You know what else helps? Not using contractions and introducing an unbalanced single quote.

[–] [email protected] 37 points 9 months ago (1 children)

If they'd'nt've done that, it'd've been better. Agreed.

load more comments (1 replies)
load more comments (1 replies)
[–] [email protected] 28 points 9 months ago

Imagine the regex needed to highlight code with that extra single quote.

[–] olafurp 25 points 9 months ago (7 children)

I'd take a not or "if not" operator tbh.

load more comments (7 replies)
[–] muntedcrocodile 17 points 9 months ago* (last edited 9 months ago) (1 children)

With ahit like that its not microsoft java its now microsoft javascript

load more comments (1 replies)
[–] Thcdenton 17 points 9 months ago (1 children)
load more comments (1 replies)
[–] [email protected] 15 points 9 months ago* (last edited 9 months ago) (2 children)
ifn't (myNum don't= 3 && myStr ain'tnull'rblankish)
[–] felbane 15 points 9 months ago (1 children)

Please remain calm, we are sending paramedics to your location.

load more comments (1 replies)
load more comments (1 replies)
[–] AlmightySnoo 12 points 9 months ago* (last edited 9 months ago)

reminds me of #ifndef instead of #if !defined(...)

[–] [email protected] 10 points 9 months ago (4 children)
[–] [email protected] 44 points 9 months ago (2 children)
[–] SpaceNoodle 18 points 9 months ago (2 children)
load more comments (2 replies)
load more comments (1 replies)
load more comments (3 replies)
[–] [email protected] 9 points 9 months ago (2 children)

die unless $keyword == "unless";

load more comments (2 replies)
[–] PanArab 9 points 9 months ago* (last edited 9 months ago) (1 children)

This can't be for real. I'll stick with C11 thank you.

[–] [email protected] 27 points 9 months ago

Here you dropped this:

#define ifnt(x) if (!(x))
load more comments
view more: next ›