How could my code tell a compile-time constant versus a variable?

后端 未结 3 2055
情话喂你
情话喂你 2020-12-10 08:32

Here\'s my problem. I have a BINARY_FLAG macro:

#define BINARY_FLAG( n ) ( static_cast( 1 << ( n ) ) )

Whic

3条回答
  •  独厮守ぢ
    2020-12-10 08:40

    I suggest you use two macros. BINARY_FLAG CONST_BINARY_FLAG That will make your code easier to grasp for others. You do know, at the time of writing, if it is a const or not. And I would in no case worry about runtime overhead. Your optimizer, at least in VS, will sort that out for you.

提交回复
热议问题