【发布时间】:2013-04-21 19:11:52
【问题描述】:
我写了以下代码:
struct DVDARRAY
{
int length;
pDVD* dvds;
};
typedef struct DVDARRAY DVDARRAY_t;
//...
int main()
{
int i;
char c;
DVDARRAY_t* dvds;
poDAOproperties props;
props = get_dao_properties();
dvds = (DVDARRAY_t*) DVDDAO_read_raw_filter(props, "id = 1");
printf("title->: %s", dvds->dvds[0]->title);
}
在另一个文件中定义了以下内容:
DVDARRAY_t* DVDDAO_read_raw_filter(poDAOproperties properties, char* filter)
{
DVDARRAY_t *dvds;
// ...some code...
dvds = malloc(sizeof(DVDARRAY_t));
// ...some code...
return dvds;
}
现在我的问题是:当我尝试编译这些文件时,我收到以下警告:
src/main.c: In Funktion »main«:
src/main.c:80:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
main.c 的第 80 行正是该行:
dvds = (DVDARRAY_t*) DVDDAO_read_raw_filter(props, "id = 1");
我能做什么?
【问题讨论】:
-
我不会说德语。您能否将错误消息翻译成英语、法语、拉丁语或匈牙利语?
-
帮我们一个忙,发帖到 SO 时使用
LANG=C gcc -
两个文件中都定义了结构 DVDARRAY_t 吗?
-
我认为调用函数时不需要额外的演员表。程序是否产生正确的输出?
-
DVDARRAY_t 在 DVD.h 中定义,它也包含在 main.c 和 DVDDAO.c 中...