我面對一個宏的問題,我不明白爲什麼。這個宏有什麼問題?
下面是宏:
#define WAIT(condition, max_time) \
do { \
int int_loop_wait=0; \
while(1) \
{ \
if(condition) { break; } \
sleep(1); \
if(int_loop_wait>=max_time) { break; } \
int_loop_wait++; \
} \
} while(0) \
我得到了錯誤
「預期聲明」 行 「如果(條件){打破;}」
有誰理解這個錯誤?
您不會更改循環內的'int_loop_wait'。 'max_time'沒有效果。 – Dipto 2013-03-26 11:12:50
真的!我現在改變它。我保持你更新 – Joze 2013-03-26 11:13:37
@ Krishnabhadra 這是一個宏,所以我不想要分號(它將被添加到代碼中) – Joze 2013-03-26 11:14:21