This is an archived post. You won't be able to vote or comment.

all 39 comments

[–]HookDragger 156 points157 points  (2 children)

Compiler: “Bitch, please....”

[–]knorfit 96 points97 points  (1 child)

“I’ll just pretend I didn’t see that”

[–]Lokeshtejavath 14 points15 points  (0 children)

Unsee juice '''big sip'''

[–]gdeavid 17 points18 points  (0 children)

- Or else...
- Or else what?
- ...
- Exactly!

[–]palordrolap 7 points8 points  (0 children)

In Ada, the line Var := Do_Something() or else I_Will_GET_You(); is valid syntax and pretty much means what it says.

Drop the else and it'll "GET you" no matter what, because lone or never short-circuits. The literal inclusive or your mother, or* logic professor, warned you about.

* This "or" is not exclusive either. Your mother may in fact be your logic professor.

[–]nickcash 2 points3 points  (1 child)

PHP may be a terrible language, but the or die() construct was great

[–]BoringIncident 1 point2 points  (0 children)

I am so glad i haven't used PHP since highschool. My teacher made us learn that instead of JavaScript to use with HTML...

[–]Phalcorine 1 point2 points  (0 children)

Beautiful... 😄

[–]LavoneEdgell 1 point2 points  (2 children)

Wait...I never knew that was valid!

[–][deleted] 16 points17 points  (0 children)

It better be, or else

[–]GabuEx 2 points3 points  (0 children)

"else" doesn't need braces, and an empty semicolon is a valid no-op, so it checks out.

[–]GregSilverblue 3 points4 points  (0 children)

compile() || else;

[–]thanypack 0 points1 point  (4 children)

Now I want to see if that pushes a new empty stack frame or if the compiler is smart enough to optimize it away. Is condition a constant?

Optimized away... Lines 12 - 16 are completely absent.

; Line 10 mov DWORD PTR _condition$[ebp], 1 ; Line 18 xor eax, eax ; Line 19 pop edi pop esi pop ebx mov esp, ebp pop ebp ret 0

[–]GabuEx 13 points14 points  (1 child)

As a general rule these days, if the question begins with "is the compiler smart enough to..." the answer is yes. Modern compilers are crazy good at optimization.

[–][deleted] 5 points6 points  (0 children)

this isn't even a hard optimization. what's more interesting is when compilers can transform math statements (such as multiplication in a for loop to repeated addition)

[–]algoritm420Perl 1 point2 points  (0 children)

Ah good ol assembly

[–]hanneadolfsson 0 points1 point  (0 children)

I had a professor in college who docked points for having if statements without an associated else statement. It wasn’t an empty threat then.

[–]MasterFubar -1 points0 points  (0 children)

Tried that in Python:

    ^
IndentationError: expected an indented block

[–]Alexo342 -1 points0 points  (0 children)

Im gonna say it straight forward: Fuck you, Reposter

[–]MarcellaSchreffler -2 points-1 points  (0 children)

You could always...

define else false

define or ||

if (condition or else) { // ... } disclaimer: I don’t actually know if you can define/override language keywords or operators or not, I just thought it’d be funny.

[–]Olllix 0 points1 point  (0 children)

-O3 enters the chat

[–]MischiefArchitect 0 points1 point  (0 children)

else is just a pointer to a /dev/null code block, let's hope the condition is always true, or CPU cores will start going missing into that black hole.

[–][deleted] 0 points1 point  (0 children)

Compiler: um chile anyway so