I am new to C but I'm currently working on a project and I am hitting a strange problem.
I have the following piece of code:
int insertID = 0;
asprintf(&inboundSql, "INSERT INTO DataTable VALUES (%i, %i, '%s', '%s', %i),"
"(%i, %i, '%s', '%s', %i), (%i, %i, '%s', '%s', %i), (%i, %i, '%s', '%s', %i),"
"(%i, %i, '%s', '%s', %i), (%i, %i, '%s', '%s', %i)",
dataRow, D_DATE, callLogSearchData[dataRow].date, epochBuffer, insertID++,
dataRow, D_TIME, callLogSearchData[dataRow].time, epochBuffer, insertID++,
dataRow, D_APARTY, callLogSearchData[dataRow].aParty, epochBuffer, insertID++,
dataRow, D_BPARTY, callLogSearchData[dataRow].bParty, epochBuffer, insertID++,
dataRow, D_DURATION, durationBuffer, epochBuffer, insertID++,
dataRow, D_RESULT, callLogSearchData[dataRow].cleardownCause, epochBuffer, insertID++);
When I compile the code, I get the following:
warning: operation on insertID may be undefined
Even though I get the above warning, my code is working as expected so I don't understand what the problem is. I guess it thinks there's something wrong with doing insertID++ but I can't see why that should be a problem.
Thanks for your help.