“警告:初始化使指针从整数开始而没有强制转换”。但我不认为 [英] "warning: initialization makes pointer from integer without a cast". But I don't think it does

查看:128
本文介绍了“警告:初始化使指针从整数开始而没有强制转换”。但我不认为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到一个奇怪的编译警告。它是断断续续的,并且不会出现在每个版本中。我收到以下行的警告:初始化使指针从整数转换而没有强制转换:

I'm getting a strange compile warning. It's intermittent, and doesn't appear every build. I get the warning "initialization makes pointer from integer without a cast" for the following line:

callbackTable *callbacks = generateLoggingCallback();

为完整起见,给出相同的结果

and, for completeness, this gives the same outcome

callbackTable *callbacks;
callbacks = generateLoggingCallback();

该函数的原型为:

callbackTable *generateLoggingCallback();

,实现是

callbackTable *generateLoggingCallback() { ... }

所以,我我不太清楚是什么问题。

So, I'm not quite sure what the problem is. Ideas?

推荐答案

如果是纯C语言,是否有关于未知功能的警告?如果是,则编译器确定未知函数返回int,然后继续执行..检查是否包含正确的标头,并且在使用该函数之前对其进行声明。

If it's pure C, isn't there a warning about 'unknown' function? if yes, then the compiler decides that the unknown function returns int, and continues on.. check if proper headers are included, and the function is declared before it's used.

这篇关于“警告:初始化使指针从整数开始而没有强制转换”。但我不认为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆