Created
August 3, 2013 23:45
-
-
Save mwotton/6148426 to your computer and use it in GitHub Desktop.
whee, i made their pointless C compile!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef struct { | |
int girlfriend; | |
} holder; | |
typedef struct { | |
holder a; | |
} toplevel; | |
typedef struct { | |
int this; | |
} yoda; | |
int main() { | |
holder holder = { 2 }; | |
yoda understand = { 2 }; | |
toplevel get = {holder}; | |
int you = 2; | |
/* whee, i made this stupid code work! */ | |
if (you == understand.this) { | |
get.a.girlfriend; | |
} | |
return 0; | |
} |
jplitza: ooh, i like that one, but changing the Axe code to be less stupid is a definite no-no.
It compiled and ran successfully, both on my machine and in the REPL output you posted.
Common Lisp
* (let* ((you 1) (understand.this 1) (get.a.girlfriend "HODOR!"))
(progn
(defmacro custom-if (func if-form block-start result block-end)
(list `,func `(,(cadr if-form) ,(car if-form) ,(caddr if-form)) result))
(setf (symbol-function '==) (function =)))
(custom-if
if (you == understand.this) {
get.a.girlfriend;
}
))
"HODOR!"
@pranavrc All the props.
yes, I think @pranavrc wins this thread with that one, macro-to-the-max!
Instead of trying to defend original code I'll propose how it should actually look to make sense:
if (you.understand(this)){
you.get_a_girlfriend();
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@alexindigo:
My point was that it didn't compile. 😉