结构问题 [英] Problem With Structure
问题描述
美好的一天,
这是我在我的代码中使用的结构
typedef struct storable_picture
{
PictureStructure结构;
int poc;
int top_poc;
int bottom_poc;
int frame_poc;
int order_num;
int ref_pic_num [6 * MAXLISTSIZE];
int frm_ref_pic_num [6 * MAXLISTSIZE];
int top_ref_pic_num [6 * MAXLISTSIZE];
int bottom_ref_pic_num [6 * MAXLISTSIZE];
unsigned frame_num;
int pic_num;
int long_term_pic_num;
int long_term_frame_idx;
int is_long_term;
int used_for_reference;
int is_output;
int non_existing;
int size_x,size_y, size_x_cr,size_y_cr;
int chroma_vector_adjustmen t;
int coded_frame;
int MbaffFrameFlag;
unsigned short imgY [176 * 144];
unsigned short imgUV [2 * 88 * 72];
unsigned char mb_field [99];
char ref_idx [2 * 36 * 44] ;
int ref_pic_id [6 * 36 * 44];
int ref_id [6 * 36 * 44];
short mv [2 * 44 * 36 * 2];
unsigned char moving_block [44 * 36];
unsigned char field_frame [44 * 36];
struct storable_picture * top_field;
struct storable_picture * bottom_field;
struct storable_picture * frame;
int chroma_format_idc;
int frame_mbs_only_flag;
} StorablePicture;
上面的结构在头文件中。在
项目,我在函数中使用以下语句(我有
包含声明结构的头文件)
StorablePicture * s;
s = calloc(1,sizeof(StorablePicture));
我在第二行保留断点,当我编译时,编译器
没有报告错误。当我运行代码时,未处理的异常
发生在使用
calloc为结构分配内存的地方问题出在哪里?帮帮我.....
Good Day,
Here is a structure that i am using in my code
typedef struct storable_picture
{
PictureStructure structure;
int poc;
int top_poc;
int bottom_poc;
int frame_poc;
int order_num;
int ref_pic_num[6*MAXLISTSIZE];
int frm_ref_pic_num[6*MAXLISTSIZE];
int top_ref_pic_num[6*MAXLISTSIZE];
int bottom_ref_pic_num[6*MAXLISTSIZE];
unsigned frame_num;
int pic_num;
int long_term_pic_num;
int long_term_frame_idx;
int is_long_term;
int used_for_reference;
int is_output;
int non_existing;
int size_x, size_y, size_x_cr, size_y_cr;
int chroma_vector_adjustment;
int coded_frame;
int MbaffFrameFlag;
unsigned short imgY[176*144];
unsigned short imgUV[2*88*72];
unsigned char mb_field[99];
char ref_idx[2*36*44];
int ref_pic_id[6*36*44];
int ref_id[6*36*44];
short mv[2*44*36*2];
unsigned char moving_block[44*36];
unsigned char field_frame[44*36];
struct storable_picture *top_field;
struct storable_picture *bottom_field;
struct storable_picture *frame;
int chroma_format_idc;
int frame_mbs_only_flag;
} StorablePicture;
The above structure is in a header file.In another c file in the
project,i am using the following statements in a function(I have
included the header file where the structure is declared)
StorablePicture *s;
s = calloc (1,sizeof(StorablePicture));
I kept a breakpoint at the second line and when i compile,the compiler
is not reporting an error.when i run the code,an unhandled exception
occurs at the place where memory is allocated for the structure using
calloc.Where is the problem?Help me out.....
推荐答案
哈利说:
Harry said:
问题出在哪里?
Where is the problem?
在代码中你没有发布。
-
Richard Heathfield
Usenet是一个奇怪的地方 - dmr 29/7/1999
http://www.cpax.org.uk
电子邮件:rjh在上面的域名(但显然放弃了www)
In the code you didn''t post.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
我没有得到你... .do你想要代码
Richard Heathfield写道:
I didn''t get u...do u want the code
Richard Heathfield wrote:
Harry说:
Harry said:
问题出在哪里?
Where is the problem?
在代码中你没有发布。
-
Richard Heathfield
Usenet是一个奇怪的地方 - dmr 29/7/1999
http://www.cpax.org.uk
电子邮件:rjh在上面的域名(但显然放弃了www)
In the code you didn''t post.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Harry写道:
Harry wrote:
我没有得到你...你想要的代码
Richard Heathfield写道:
I didn''t get u...do u want the code
Richard Heathfield wrote:
> Harry说:
>Harry said:
>>问题出在哪里?
>>Where is the problem?
在代码中你没有发布。
-
理查德希思菲尔德
Usenet是一个奇怪的地方 - dmr 29/7/1999
http://www.cpax.org.uk
电子邮件:rjh在上面的域名(但显然放弃了www)
In the code you didn''t post.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
不要发帖。
他说问题出在其他地方,而不是你发布的两条
行中的任何一行。
(C就像那样 - 做一些你不应该去的地方,并且
它可能会导致其他地方的错误)
Don''t top post.
He is saying the problem is elsewhere, not in any of the two
lines you posted.
(C is like that -- do something your''re not supposed to one place, and
it might result in an error elsewhere)
这篇关于结构问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!