Why are preprocessor macros evil and what are the alternatives?

前端 未结 8 2210
面向向阳花
面向向阳花 2020-11-22 02:46

I have always asked this but I have never received a really good answer; I think that almost any programmer before even writing the first \"Hello World\" had encountered a p

8条回答
  •  猫巷女王i
    2020-11-22 02:54

    I think that the problem is that macros are not well optimized by the compiler and are "ugly" to read and debug.

    Often a good alternatives are generic functions and/or inline functions.

提交回复
热议问题