static const vs #define

前端 未结 11 973
醉话见心
醉话见心 2020-11-22 13:01

Is it better to use static const vars than #define preprocessor? Or maybe it depends on the context?

What are advantages/disadvantages for

11条回答
  •  不知归路
    2020-11-22 13:24

    Please see here: static const vs define

    usually a const declaration (notice it doesn't need to be static) is the way to go

提交回复
热议问题