Created
November 2, 2012 01:00
-
-
Save mntmn/3997977 to your computer and use it in GitHub Desktop.
A program that is ruby and C at the same time. Weird!
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
#ifndef false /* | |
# | |
# Written on Nov 2, 2012 by @mntmn | |
# | |
# This program is both ruby and C. Try it out: | |
# | |
# gcc hello.rb.c -o hello | |
# ./hello | |
# | |
# ruby hello.rb.c | |
# | |
def if_ruby | |
yield | |
end | |
def if_c | |
end | |
def main | |
yield | |
end | |
def void(f) | |
end | |
#*/ | |
#endif | |
#include <stdio.h> | |
#define puts(X) printf(X); | |
#define if_ruby if(0) | |
#define if_c if(1) | |
void main() { | |
puts("Hello world.\n") | |
if_ruby { | |
puts("This is ruby.\n") | |
} | |
if_c { | |
puts("This is C.\n") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
😃