Where the C macros stored in memory and how does it consumes more memory compared to functions?

后端 未结 4 1050
孤城傲影
孤城傲影 2021-01-22 11:05

I searched in web where will be the C macros stored in memory and how does it consumes more memory compared to functions? Could not get any satisfying answer .Can anyone please

4条回答
  •  粉色の甜心
    2021-01-22 11:07

    Macros are a preprocessor construct. All macros are replaced by their definitions before the compiler even sees the code.

    This means that if you use a lot of macros with large replacements, they will generate a lot code. Function calls don't work that way, since they call a single function that only has the code once.

    There is no standard way of figuring out how much code is due to macros, no.

提交回复
热议问题