我的代碼包含錯誤:#29:用C
#define READ_TAMPER_PIN() {((FIO2PIN & PIN_TAMPER) >> 12) ;}
其中PIN_TAMPER
又是一個宏
#define PIN_TAMPER 0x00001000;
在頭文件中的一個
,並且它被稱爲主()之類
x = READ_TAMPER_PIN();
它提供了一個錯誤說「錯誤:#29:預期表達式」
什麼可能是我犯的錯誤?
我的代碼包含錯誤:#29:用C
#define READ_TAMPER_PIN() {((FIO2PIN & PIN_TAMPER) >> 12) ;}
其中PIN_TAMPER
又是一個宏
#define PIN_TAMPER 0x00001000;
在頭文件中的一個
,並且它被稱爲主()之類
x = READ_TAMPER_PIN();
它提供了一個錯誤說「錯誤:#29:預期表達式」
什麼可能是我犯的錯誤?
根據C99標準(§6.10.3#10)
形式的預處理指令
#限定標識符LPAREN標識符listopt)替換列表新行
#定義標識LPAREN ...)替換列表換行
#定義標識LPAREN標識符表,...)替換列表換行
defines a function-like macro with arguments, similar syntactically to a function call. The parameters are specified by the optional list of identifiers, whose scope extends from their declaration in the identifier list until the new-line character that terminates the #define preprocessing directive. Each subsequent instance of the function-like macro name followed by a ( as the next preprocessing token introduces the sequence of preprocessing tokens that is replaced by the replacement list in the definition (an invocation of the macro). The replaced sequence of preprocessing tokens is terminated by the matching ) preprocessing token, skipping intervening matched pairs of left and right parenthesis preprocessing tokens. Within the sequence of preprocessing tokens making up an invocation of a function-like macro, new-line is considered a normal white-space character.
注:它的「錯誤:預期的表達」,在嵌入式C – YMJ