{"id":6090,"date":"2014-04-13T01:23:25","date_gmt":"2014-04-13T01:23:25","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/13\/problem-about-stringification-collection-of-common-programming-errors\/"},"modified":"2014-04-13T01:23:25","modified_gmt":"2014-04-13T01:23:25","slug":"problem-about-stringification-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/13\/problem-about-stringification-collection-of-common-programming-errors\/","title":{"rendered":"problem about stringification-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/a0c394e31c9740376635c8878cf5889e?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nNone<br \/>\nc function macros stringification<br \/>\nIs there any way to unstringify strings provided as macro arguments? I need to be able to call functions who&#8217;s names are in strings. Something like this:void hello() {printf(&#8220;Hello, world!&#8221;); }call_func(&#8220;hello&#8221;);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&#8217;t have to be in strings but could be passed as an argument to a function that would be ok to.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/7d0d66b076e3bc70819e50f8a25af8df?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJonathan Leffler<br \/>\nc++ templates preprocessor stringification<br \/>\nIs it possible in C++ to stringify template arguments? I tried this:#define STRINGIFY(x) #xtemplate &lt;typename T&gt; struct Stringify {Stringify(){cout&lt;&lt;STRINGIFY(T)&lt;&lt;endl;} };int main() {Stringify&lt;int&gt; s; }But what I get is a &#8216;T&#8217;, and not an &#8216;int&#8217;. 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++).<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/bba62b5966898855dde021a9a00cfffc?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nwwaawaw<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/dd11cabc6f1779ffa658654bec8551db?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nDan<br \/>\nc++ include preprocessor opencl stringification<br \/>\nNote: This question has nothing to do with OpenCL per se&#8230; check the last paragraph for a succinct statement of my question. But to provide some background:I&#8217;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<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;s names are in strings. Something like this:void hello() {printf(&#8220;Hello, world!&#8221;); }call_func(&#8220;hello&#8221;);How would I implement call_func. It would be in a module that would be #included and would be used to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6090","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6090","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6090"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6090\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6090"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6090"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6090"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}