如何修正对'col'gmake的警告多个未排序的修改

时间:2019-07-02 16:41:59

标签: c++

编译时会收到警告

    while ((row = mysql_fetch_row(pRes->pSQLResult)) != NULL)
    {
        int col = 5;
        char attrs[1024] = { '\0' };
        char sockets[1024] = { '\0' };
        for (int i = 0; i<ITEM_SOCKET_MAX_NUM; i++)
            sprintf(sockets, "%s%s%s", sockets, row[col++], (i<ITEM_SOCKET_MAX_NUM-1 ? "|" : ""));
        //col--;

        for (int i = 0; i<ITEM_ATTRIBUTE_MAX_NUM; i++)
            sprintf(attrs, "%s%s,%s%s", attrs, row[col++], row[col++], (i<ITEM_ATTRIBUTE_MAX_NUM-1 ? "|" : ""));
        ch->ChatPacket(CHAT_TYPE_COMMAND, "shop_item %s#%s#%s#%s#%s#%s#%s", row[0], row[1], row[2], row[3], row[4], sockets, attrs);
    }

警告:对'col'的多个无序修改       [-未排序]

警告行:sprintf(attrs,“%s%s,%s%s”,attrs,row [col ++],row [col ++],(i

0 个答案:

没有答案