警告:“g_hash_table_iter_next 来自不兼容的指针类型”在 Vala 中使用 HashTagIter
以下代码可以编译但会发出警告。所以我想了解真正纠正它时会发生什么(我不喜欢在编译时发出警告的想法):
// 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
正如我所说,代码编译并且运行良好(目前没有段错误或其他任何东西) )。
我该如何解决这个警告?
谢谢,
达米安
The following code compile but raise warnings. So I would like to understand what happen really to correct it (I don't like the idea to have warnings at compilation) :
// 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 );
}
The warnings :
/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
As I said, the code compile and it works well (no segfault or anything else for the moment).
How can I fix this warning ?
Thanks,
Damien
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
忽略 CC 警告,您无法修复它们。您只想查看 Vala 警告。
Ignore CC warnings, you can't fix them. You only want to look at Vala warnings.