C Language preprocessing doubt

Posted by khanna_param on Super User See other posts from Super User or by khanna_param
Published on 2010-05-29T03:56:20Z Indexed on 2010/05/29 4:02 UTC
Read the original article Hit count: 184

Filed under:
|

Hi,

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 complile to get the result.

My question:- 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 compiler traverses the program to replace the macro with the replacement values. I assume it cannot be done in one go.

Thanks.

© Super User or respective owner

Related posts about macros

Related posts about c