problem about stringification-Collection of common programming errors
None
c function macros stringification
Is there any way to unstringify strings provided as macro arguments? I need to be able to call functions who’s names are in strings. Something like this:void hello() {printf(“Hello, world!”); }call_func(“hello”);How would I implement call_func. It would be in a module that would be #included and would be used to call functions in the main c file. If there is another way to do this where the name wouldn’t have to be in strings but could be passed as an argument to a function that would be ok to.
Jonathan Leffler
c++ templates preprocessor stringification
Is it possible in C++ to stringify template arguments? I tried this:#define STRINGIFY(x) #xtemplate <typename T> struct Stringify {Stringify(){cout<<STRINGIFY(T)<<endl;} };int main() {Stringify<int> s; }But what I get is a ‘T’, and not an ‘int’. Seems that the preprocessors kicks in before template resolution.Is there any other way to do this?Is there any way for the preprocessing to take place after template resolution? (Compiler is VC++).
wwaawaw
Dan
c++ include preprocessor opencl stringification
Note: This question has nothing to do with OpenCL per se… check the last paragraph for a succinct statement of my question. But to provide some background:I’m writing some C++ code that makes use of OpenCL. I like to keep the source for my OpenCL kernels in their own files, to keep coding and maintenance easy (as opposed to embedding the sources directly as string constants in associated C++ code). This inevitably leads to the question of how to load them into the OpenCL runtime once it comes
Web site is in building