VS 2015认可的typedef enum定义和声明方式

调试一个程序,遇到报错:
Warning C4091 'typedef ': ignored on left of ‘XXX’ when no variable is declared XXX

参考博文:https://blog.csdn.net/weixin_37787043/article/details/79017817
其中的例子:

typedef enum
{
    saturday,
    sunday = 0,
    monday,
    tuesday,
    wednesday,
    thursday,
    friday
} workday; //此处的workday为枚举型enum workday的别名

workday today, tomorrow; //变量today和tomorrow的类型为枚举型workday,即enum workday

解决了该bug。

知识点:别名放到{}的后面,;的前面。

你可能感兴趣的:(bug)