警告:来自不兼容指针类型的'g_hash_table_iter_next'与Vala中的HashTagIter

时间:2012-02-01 21:42:23

标签: warnings hashtable vala

以下代码编译但会引发警告。所以我想了解真正发生了什么事情来纠正它(我不喜欢在编译时发出警告的想法):

// Display couples
// words is a HashTable<string, int> with words and the number of matches in a text
var iter = HashTableIter<string, int>( words );
string key;
int val;
while ( iter.next( out key, out val ) == true )     // TODO Look what 'out' is for
{
    stdout.printf( "%s : %d\n", key, val );
}

警告:

/Users/horizon/Projets/voynich/src/Voynich.vala.c:534: warning: passing argument 2 of ‘g_hash_table_iter_next’ from incompatible pointer type
/Users/horizon/Projets/voynich/src/Voynich.vala.c:534: warning: passing argument 3 of ‘g_hash_table_iter_next’ from incompatible pointer type
/Users/horizon/Projets/voynich/src/Voynich.vala.c:538: warning: assignment makes integer from pointer without a cast

正如我所说,代码编译并且运行良好(暂时没有段错或其他任何内容)。

如何修复此警告?

谢谢,

达明

1 个答案:

答案 0 :(得分:2)

忽略CC警告,你无法修复它们。你只想看看Vala警告。