Why is assert a macro and not a function?

前端 未结 5 815
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-23 16:06

My lecturer has asked me that in class, and I was wondering why is it a macro instead of a function?

5条回答
  •  既然无缘
    2020-12-23 16:33

    Why is assert a macro and not a function?

    Because it should compiled in DEBUG mode and should not compiled in RELEASE mode.

提交回复
热议问题