Quote needed: Preprocessor usage is bad OO practice

后端 未结 14 1522
失恋的感觉
失恋的感觉 2020-12-09 04:29

I believe, that the usage of preprocessor directives like #if UsingNetwork is bad OO practice - other coworkers do not. I think, when using an IoC container (e.

14条回答
  •  佛祖请我去吃肉
    2020-12-09 04:58

    Preprocessor code injection is to the compiler what triggers are to the database. And it's pretty easy to find such assertions about triggers.

    I mainly think of #define being used to inline a short expression because it saves the overhead of a function call. In other words, it's premature optimization.

提交回复
热议问题