-
-
Save tekknolagi/7b86202d43601c16450c773406a060bf to your computer and use it in GitHub Desktop.
A gensym implementation of C/C++ Preprocessor.
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 STRINGIFY(x) #x | |
#define EXTRACT(...) __VA_ARGS__ | |
#define INVOKE(macro,args...) macro( EXTRACT(args) ) | |
#define FIRST(x,...) x | |
#define REST(x,...) __VA_ARGS__ | |
#define __sym(cn,ln) _ainini_##c##cn##l##ln | |
#define sym(cn,ln) __sym(cn,ln) | |
#define __gensym(cn, ln) sym( cn,ln ) | |
//@TODO: IMPLEMENT A `__COUNTER__` TO FIT C/CPP STANDARDS | |
#define gensym() __gensym(__COUNTER__, __LINE__) | |
struct fck{ | |
explicit fck(int a = 0){} | |
}; | |
TestCase(GENSYM){ | |
int gensym() = 1;fck gensym()(2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment