1
#include<vector>
#include<stdint.h>
#define RAM_M_V_INSERT_T32(vec,Long,pos) \
vec.at(pos)=(((tU8)((Long) >> 24)) & 0xFF); \
pos++;\
vec.at(pos)=(((tU8)((Long) >> 16)) & 0xFF); \
pos++;\
vec.at(pos)=(((tU8)((Long) >> 8)) & 0xFF); \
pos++;\
vec.at(pos)=(((tU8)((Long))) & 0xFF);
int main()
{
std::vector<char> c8vBuf;
c8vBuf.at(0)=(char)SYSTEM_U32_SHUTDOWN_CPU_WATCHDOG;
RAM_M_V_INSERT_T32(c8vBuf, (_u32WdtCount - 1),1);
RAM_M_V_INSERT_T32(c8vBuf, _u32WdtCount,5);
return 0;
}
當我嘗試編譯的問題,我得到這個錯誤,有關遞增操作數宏給出了GCC
cstr.cpp:19:3: error: lvalue required as increment operand
cstr.cpp:19:3: error: lvalue required as increment operand
cstr.cpp:19:3: error: lvalue required as increment operand
cstr.cpp:20:3: error: lvalue required as increment operand
cstr.cpp:20:3: error: lvalue required as increment operand
cstr.cpp:20:3: error: lvalue required as increment operand
請人闡明這光???
你期望1 ++和5 ++能做什麼? – chris
是否有一個允許使用宏的編譯器,或者是您使用GCC的事實只是特定的編譯器,而您沒有在其他編譯器上測試代碼? –
您可以(也應該)運行您的編譯器來喚醒預處理器,並檢查生成的代碼。它可以啓發。 – ChuckCottrill