【发布时间】:2011-12-08 01:53:52
【问题描述】:
当我在 g++ 下编译时,出现以下错误:
在函数
'int search(int, int, int)':1584:error: 在
'* tt = & core.<anonymous union>::tt[((hash_stack[ply] >> 16) & 2047ul)]'中与'operator='不匹配1584:error: 注意:候选人是:
118:注:
tt_type& tt_type::operator=(const tt_type&)118:注意:没有已知的参数 1 从
'tt_type*'到'const tt_type&'的转换
static int search(int depth, int alpha, int beta) {
int best_score = -INF;
int best_move = 0;
int score;
struct move *moves;
int incheck = 0;
struct tt_type *tt; //LINE 1584
int oldalpha = alpha;
int oldbeta = beta;
int i, count=0;
nodes++;
/* test for draw by repetition */
hash_stack[ply] = compute_hash();
for (i=ply-4; i>=board[LAST]; i-=2) {
if (hash_stack[i] == hash_stack[ply]) count++;
if (count>=2) return 0;
}
/*
* check transposition table
*/
*tt = &TTABLE[ ((hash_stack[ply]>>16) & (CORE-1)) ];
if (tt->hash == (hash_stack[ply] & 0xffffU)) {
if (tt->depth >= depth) {
if (tt->flag >= 0) alpha = MAX(alpha, tt->score);
if (tt->flag <= 0) beta = MIN(beta, tt->score);
if (alpha >= beta) return tt->score;
}
best_move = tt->move & 07777;
}
我之前定义的地方
struct tt_type { //LINE 118
unsigned short hash; /* - Identifies position */
short move; /* - Best recorded move */
short score; /* - Score */
char flag; /* - How to interpret score */
char depth; /* - Remaining search depth */
};
【问题讨论】:
-
所以它的长短是:“没有已知的参数 1 从 'tt_type*' 到 'const tt_type&' 的转换”