当我尝试编译以下代码时,我得到了标题中提到的错误:
void Sql::select(const string table, const string column, const string condition, const string condition_2, const string condition_3) {
otl_stream s;
otl_column_desc* desc;
int desc_len;
const string select = str(format("SELECT %2% FROM %1% WHERE LEFT(%3%, 8) < %6% AND %4% = 'Ausstehend' AND (%5% = '1' OR %5% = '2') ")
% table % column % condition % condition_2 % condition_3 % getDate());
// cout << select;
try {
s.open(10, select.c_str(), con);
} catch (otl_exception &e) {
cerr << e.msg;
}
desc = s.describe_select(desc_len);
}
我被告知otl_column_desc* desc已设置但未使用。你能告诉我哪里出了问题吗?
发布于 2013-06-26 05:26:38
这就是它所说的,你正在设置变量,但是没有使用任何地方的值,这意味着这个变量,无论出于何种目的,都是无用的。
desc = s.describe_select(desc_len);//value in desc never used
如果你在代码中犯了一个错误,并在你打算使用这个变量的时候使用了其他变量,那么有时就会发生这种情况,我猜这个警告就是为了捕捉这些情况。
但是为了回答你的问题,没有什么问题,因为这是一个警告,而不是一个错误。这只是一个迹象,表明可能出了什么问题。
https://stackoverflow.com/questions/17312125
复制相似问题