Last active
December 14, 2015 06:49
-
-
Save thenoviceoof/5045411 to your computer and use it in GitHub Desktop.
Oh god this is such a terrible idea
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
import timeit | |
# introducing a C primitive to the Python namespace for fun and profit | |
# if you're familiar with the way Python-C modules are usually built, | |
# you'll notice this is abstracting way a bunch of things, | |
# which may or may not be possible | |
# syntax: C <ret_type> <name>(...<params>...) with {<header>: <library>} | |
C str fn_name(int something) with {'stdio.h': 'stdlib', 'math.h': 'm'}: | |
// blah blah blah | |
something += 2; | |
char *s = malloc(sizeof(char)*5000000000); | |
return sprintf(s, "%d", something); | |
assert '22' == fn_name(20) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment