This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS编译警告

你好,

我的一段代码,实际就是简单的常数数组,但是编译出现警告:

warning #83-D: storage class is not first

代码段:

#define  SLOT_0  0x0001

#define  SLOT_1  0x0002

#define  SLOT_2  0x0004

 #define  SLOT_3  0x0008

 #define  SLOT_4  0x0010

#define  SLOT_5  0x0020

 #define  SLOT_6  0x0040

 #define  SLOT_7  0x0080

 #define  SLOT_8  0x0100

 #define  SLOT_9  0x0200

 #define  SLOT_10  0x0400

 #define  SLOT_11  0x0800

 #define  SLOT_12  0x1000

 #define  SLOT_13  0x2000

 #define  SLOT_14  0x4000

 #define  SLOT_15  0x8000

const static unsigned int  bit_set[16] = { SLOT_0,  SLOT_1,  SLOT_2,  SLOT_3, SLOT_4,  SLOT_5,  SLOT_6,  SLOT_7,SLOT_8,  SLOT_9,  SLOT_10, SLOT_11,SLOT_12, SLOT_13, SLOT_14, SLOT_15 };

  • 有意思的问题~

    查了一下,ANSI中定义了以下几种Storage Class Specifier:

      'typedef' /
      'extern' /
      'static' /
      'auto' /
      'register'
    但是似乎并没有规定这些Storage class specifier 一定要放在声明/定义的最前面。
    有些编译器厂商可能会倾向这类specifier放在定义最前面,所以不这样做的话,会给个warning。
    但是有的编译器就不理会这个顺序了。
  • 这种警告不用在意,虽然0警告0错误很讨人喜欢,但是一般只要0错误就行了。