C language preprocessor behavior
Posted
by khanna_param
on Stack Overflow
See other posts from Stack Overflow
or by khanna_param
Published on 2010-05-29T03:56:20Z
Indexed on
2010/05/29
6:02 UTC
Read the original article
Hit count: 309
There are different kind of macros in C language, nested macro is one of them.
Considering a program with the following macro
#define HYPE(x,y) (SQUR(x)+SQUR(y))
#define SQUR(x) (x*x)
Using this we can successfully compile to get the result.
As we all know the C preprocessor replaces all the occurrence of the identifiers with the replacement-string. Considering the above example I would like to know how many times the C preprocessor traverses the program to replace the macro with the replacement values. I assume it cannot be done in one go.
© Stack Overflow or respective owner