Simulater/Generated switch statement range in c

后端 未结 3 687
暖寄归人
暖寄归人 2021-01-28 17:52

Is there a hack to support range case in a c(99?) or objective C switch statement ? I know this is not supported to write something like this:

switch(x)
   case          


        
3条回答
  •  被撕碎了的回忆
    2021-01-28 18:10

    Doing this with macros is near to or impossible. Compiler extensions exist, but they are compiler specific and not cross-platform/standard. There is no standard way to do this, use if/else chains instead.

提交回复
热议问题