Created
April 29, 2015 03:27
-
-
Save JadenGeller/6a2782c58e779ff889aa to your computer and use it in GitHub Desktop.
C Type Inference (Let and Var)
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
#define let(name,value) const __typeof__ (value) name = value; | |
#define var(name,value) __typeof__ (value) name = value; | |
int main(int argc, char *argv[]) { | |
let(x,3); // const int x = 3; | |
var(y,5); // int y = 5; | |
printf("x:%i y:%i",x,y); // -> x:3 y:5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Jaden, we have a type inference engine to C, which is able to reconstruct some types not available in the source code. Check it out: http://cuda.dcc.ufmg.br/psyche-c/