我的代码包含错误:#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