You are viewing a single thread.
View all comments
210 points

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

do {
  /* something */
} or else {
  /* you don't want to find out */
}
permalink
report
reply
8 points

It exists, kind of. Python has this construct

for item in iterable:
    ...
else:
     ...

which always puzzles me, since it depends on a break statement execution. I always have to look it up when the else block is executed.

permalink
report
parent
reply
5 points
do {
  /* something */
} do hast {
  /* something */
}
permalink
report
parent
reply
do {
  /* something */
} do hast {
  /* something */
} do hast mich {
  /* something */
}
permalink
report
parent
reply
23 points

It_would_be_a_shame_if(condition)

permalink
report
parent
reply
10 points

The better try-catch. More intuitive if you ask me.

permalink
report
parent
reply
6 points

You just made me a offer I can’t refuse. I go now to sleep with the fishes…

permalink
report
parent
reply
60 points

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

OpenFileOrDie()
permalink
report
parent
reply
1 point

Now what about GZDoom’s GoAwayAndDie();?

permalink
report
parent
reply
3 points

It’s funnier when you try to SysCallAndDie() :-P

(that’s a real thing in perl btw - I guess that function didn’t get the memo)

permalink
report
parent
reply
4 points

One of the modules in a project I’m working on is called VulkanOrDie which always makes me crack up when I see it in the compilation messages.

permalink
report
parent
reply
10 points

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

permalink
report
parent
reply
2 points

Except rethrowing an exception in C# is just throw;, anything else is a crime against the person who reads your stacktraces.

permalink
report
parent
reply
4 points

I mean, it makes sense to call ComplainToErrorAndExit just ‘die’, no?

permalink
report
parent
reply
27 points

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

logUserIn() or die();

permalink
report
parent
reply
6 points

Or Perl

permalink
report
parent
reply
42 points

this is just a menacing try/catch!

permalink
report
parent
reply

Programmer Humor

!programmer_humor@programming.dev

Create post

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

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics

Community stats

  • 5.2K

    Monthly active users

  • 1.1K

    Posts

  • 38K

    Comments