Created
February 14, 2012 19:29
-
-
Save L3n41c/1829475 to your computer and use it in GitHub Desktop.
Interpreted C++
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
/hello |
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
# /* | |
this_md5="$(md5sum < "$0" | cut -d' ' -f1)" | |
last_md5="$(readelf -p SOURCE_FILE_HASH "${0%.cpp}" 2>/dev/null | awk '/\[ *0\]/ { print $3 }')" | |
if [ "$this_md5" != "$last_md5" ]; then | |
g++ -pipe -Wall -Wextra -std=c++0x -g -march=native -O3 -DTHIS_MD5="\"$this_md5\"" -o "${0%.cpp}" "$0" || | |
exit 1 | |
fi | |
exec "${0%.cpp}" "$@" | |
exit 1 | |
# */ | |
#ifndef THIS_MD5 | |
# define THIS_MD5 "not set" | |
#endif | |
char MD5[] __attribute__((section ("SOURCE_FILE_HASH"))) = THIS_MD5; | |
#include <cstdlib> | |
#include <iostream> | |
using namespace std; | |
int main( int argc, char *argv[] ) | |
{ | |
while( argc-- ) | |
cout << *argv++ << ' '; | |
cout << endl; | |
cout << "Hello World!" << endl; | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment