Possible duplicate:Why am I not getting the expected result in the next program c?
I have doubts about how to evaluate macros. As for the following code, I cannot figure out the output:
#include <stdio.h> #define f(a,b) a##b #define g(a) #a #define h(a) g(a) int main() { printf("%s\n",h(f(1,2))); printf("%s\n",g(f(1,2))); return 0; }
Output
12 f(1,2)
why doesn't f first expand to g in the second printf?
This is a consequence of how macros expand and affect self-referencing macros ... This is explained in some detail in the GNU CPP manual.
Source: https://habr.com/ru/post/1387013/More articles:Get only values ββfrom associative array in php - arraysIncorrect bind processing CustomControl DependencyProperty - .net-3.5How to translate a form in django? - djangoHow does Cocoa: addObserver work under the hood? - objective-cnew XMLHttpRequest in IE9 raises JScript runtime error: object does not support this property or method - javascriptAlign multiple items in an SVG container - alignmentSuggestions of a tool for specification on an example where analysts - not developers - write tests? - specificationsStop Blank Reports from Sending to SSRS 2008 R2 Data Subscription - sql-server-2008Performance Cassandra 1.0 - performanceA very large pair of key values ββin Hadoop - keyAll Articles