Can this macro be converted to a function?

后端 未结 16 1244
后悔当初
后悔当初 2020-12-05 16:27

While refactoring code and ridding myself of all those #defines that we\'re now taught to hate, I came across this beauty used to calculate the number of elements in a struc

16条回答
  •  被撕碎了的回忆
    2020-12-05 17:07

    Windows specific:

    There is the macro _countof() supplied by the CRT exactly for this purpose.

    A link to the doc at MSDN

提交回复
热议问题