警告:“g_hash_table_iter_next 来自不兼容的指针类型”在 Vala 中使用 HashTagIter

发布于 2025-01-01 03:42:41 字数 925 浏览 1 评论 0原文

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

// 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沉鱼一梦 2025-01-08 03:42:41

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

Ignore CC warnings, you can't fix them. You only want to look at Vala warnings.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文