允许未命名的struct成员? [英] Unnamed struct members allowed?

查看:72
本文介绍了允许未命名的struct成员?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用BMS地图的CICS程序。我们的所见即所得的地图编辑器在COBOL中产生了它的来源,因此我手动创建C联合以匹配

COBOL输出。我可以将FILLER语句转换为未命名的struct

成员,还是我坚持使用filler0,filler1,filler2

等场景?

01 PIDCI。

02 FILLER PICTURE X(12)。

02 MAPTRANIDL COMP PICTURE S9(4)。

02 MAPTRANIDF PICTURE X. br />
02 FILLER PICTURE X(04)。

02 MAPTRANIDI PICTURE X(04)。

等...

等...

等...

01 PIDCO REDEFINES PIDCI。

02 FILLER PICTURE X(12)。

02 FILLER PICTURE X(02)。

02 MAPTRANIDA PICTURE X.

02 MAPTRANIDC PICTURE X.

02 MAPTRANIDP PICTURE X 。

02 MAPTRANIDH PICTURE X.

02 MAPTRANIDV PICTURE X.

02 MAPTRANIDO PICTURE X(04)。

02 FILLER PICTURE X(02)。

等...

等...

等...

U nion pidc {

struct pidci {

unsigned char filler0 ??(12 ??); / *< ---<<这里* /

int maptranidl;

unsigned char maptranidf;

unsigned char filler1 ??(4 ??); / *< ---<<这里* /

unsigned char maptranidi ??(4 ??);

等...

等...

等...

} pidci; / * struct pidci * /


struct pidco {

unsigned char filler0 ??(12 ??); / *< ---<<这里* /

unsigned char filler1 ??(2 ??); / *< ---<<这里* /

unsigned char maptranida;

unsigned char maptranidc;

unsigned char maptranidp;

unsigned char maptranidh ;

unsigned char maptranidv;

unsigned char maptranido ??(4 ??);

unsigned char filler2 ??(2 ??) ; / *< ---<<这里* /

等...

等...

等...

} pidco; / * struc pidco * /

} pidc; / * union pidc * /

解决方案

文章< 11 ************** *******@c74g2000cwc.googlegroups。 com>,

Jalapeno< ja ******* @ mac.com>写道:

我有一个使用BMS地图的CICS程序。我们的所见即所得地图编辑器在COBOL中生成它的源代码所以我手动创建C联合以匹配
COBOL输出。我可以将FILLER语句转换为未命名的struct
成员,还是我坚持使用filler0,filler1,filler2
等方案。 ?




在C结构中:抱歉,不,每个字段都必须命名为

[除了指定的位域:0 - 与位域对齐有

,没有实际价值

你的情况。]

-

好​​的,只有流行语。两个音节,上衣。 - Laurie Anderson


Walter Roberson写道:

Jalapeno< ja ******* @ mac.com>写道:

我有一个使用BMS地图的CICS程序。我们的所见即所得的地图编辑器在COBOL中生成它的源代码所以我手动创建C联合符
以匹配COBOL输出。我可以将FILLER语句转换为未命名的struct成员,还是使用
filler0,filler1,filler2等来解决方案?



在C结构中:抱歉,不,每个字段都必须命名为
[除了指定为0的位域 - 它与位域对齐有关,对于你的情况没有实际价值。]




他还将COMP 4项目反映为int。即使

存储是相同的,也可能存在对齐问题,而不是C. bRC,而不是C. IIRC,它至少已经过了20年了做了任何Cobol的
。没错过。


-

一些信息链接:

新闻:news.announce.newusers
< a rel =nofollowhref =http://www.geocities.com/nnqweb/target =_ blank> http://www.geocities.com/nnqweb/
http://www.catb.org/~esr/faqs/ smart-questions.html
http://www.caliburn .nl / topposting.html
http:// www.netmeister.org/news/learn2quote.html


CBFalconer写道:


Walter Roberson写道:< blockquote class =post_quotes> Jalapeno< ja ******* @ mac.com>写道:

我有一个使用BMS地图的CICS程序。我们的所见即所得的地图编辑器在COBOL中生成它的源代码所以我手动创建C联合符
以匹配COBOL输出。我可以将FILLER语句转换为未命名的struct成员,还是使用
filler0,filler1,filler2等来解决方案?



在C结构中:抱歉,不,每个字段都必须命名为
[除了指定为0的位域 - 它与位域对齐有关,对于你的情况没有实际价值。]



他还将COMP 4项目反映为int。即使存储相同,也可能存在Cobol处理的对齐问题,但不是C. IIRC,自从我做了任何Cobol以来已经至少20年了。没错过。



我很想念Cobol,我很想念TYVM。


-

+ ---------------------------------------------- ------------------ +

|查理和弗朗西斯里士满里士满在平面点网|

+ ------------------------------- --------------------------------- +


I''ve a CICS program that uses BMS maps. Our wysiwyg map editor produces
it''s source in COBOL so I am manually creating C unions to match the
COBOL output. Can I convert the FILLER statements to unnamed struct
members or am I stuck with the scenario using filler0, filler1, filler2
etc. ?
01 PIDCI.
02 FILLER PICTURE X(12).
02 MAPTRANIDL COMP PICTURE S9(4).
02 MAPTRANIDF PICTURE X.
02 FILLER PICTURE X(04).
02 MAPTRANIDI PICTURE X(04).
etc...
etc...
etc...
01 PIDCO REDEFINES PIDCI.
02 FILLER PICTURE X(12).
02 FILLER PICTURE X(02).
02 MAPTRANIDA PICTURE X.
02 MAPTRANIDC PICTURE X.
02 MAPTRANIDP PICTURE X.
02 MAPTRANIDH PICTURE X.
02 MAPTRANIDV PICTURE X.
02 MAPTRANIDO PICTURE X(04).
02 FILLER PICTURE X(02).
etc...
etc...
etc...
union pidc {
struct pidci {
unsigned char filler0??(12??); /* <---<< here */
int maptranidl;
unsigned char maptranidf;
unsigned char filler1??(4??); /* <---<< here */
unsigned char maptranidi??(4??);
etc...
etc...
etc...
} pidci; /* struct pidci */

struct pidco {
unsigned char filler0??(12??); /* <---<< here */
unsigned char filler1??(2??); /* <---<< here */
unsigned char maptranida;
unsigned char maptranidc;
unsigned char maptranidp;
unsigned char maptranidh;
unsigned char maptranidv;
unsigned char maptranido??(4??);
unsigned char filler2??(2??); /* <---<< here */
etc...
etc...
etc...
} pidco; /* struc pidco */
} pidc; /* union pidc */

解决方案

In article <11*********************@c74g2000cwc.googlegroups. com>,
Jalapeno <ja*******@mac.com> wrote:

I''ve a CICS program that uses BMS maps. Our wysiwyg map editor produces
it''s source in COBOL so I am manually creating C unions to match the
COBOL output. Can I convert the FILLER statements to unnamed struct
members or am I stuck with the scenario using filler0, filler1, filler2
etc. ?



Within a C struct: sorry, no, every field must be named
[with the exception of a bitfield specified as :0 -- which has
to do with bitfield alignment and has no practical value for
your situation.]
--
Okay, buzzwords only. Two syllables, tops. -- Laurie Anderson


Walter Roberson wrote:

Jalapeno <ja*******@mac.com> wrote:

I''ve a CICS program that uses BMS maps. Our wysiwyg map editor
produces it''s source in COBOL so I am manually creating C unions
to match the COBOL output. Can I convert the FILLER statements
to unnamed struct members or am I stuck with the scenario using
filler0, filler1, filler2 etc. ?



Within a C struct: sorry, no, every field must be named
[with the exception of a bitfield specified as :0 -- which has
to do with bitfield alignment and has no practical value for
your situation.]



He was also reflecting a COMP 4 item as an int. Even if the
storage is the same, there may be alignment problems handled by
Cobol, but not C. IIRC, it''s been at least 20 years since I did
any Cobol. Not greatly missed.

--
Some informative links:
news:news.announce.newusers
http://www.geocities.com/nnqweb/
http://www.catb.org/~esr/faqs/smart-questions.html
http://www.caliburn.nl/topposting.html
http://www.netmeister.org/news/learn2quote.html


CBFalconer wrote:


Walter Roberson wrote:

Jalapeno <ja*******@mac.com> wrote:

I''ve a CICS program that uses BMS maps. Our wysiwyg map editor
produces it''s source in COBOL so I am manually creating C unions
to match the COBOL output. Can I convert the FILLER statements
to unnamed struct members or am I stuck with the scenario using
filler0, filler1, filler2 etc. ?



Within a C struct: sorry, no, every field must be named
[with the exception of a bitfield specified as :0 -- which has
to do with bitfield alignment and has no practical value for
your situation.]



He was also reflecting a COMP 4 item as an int. Even if the
storage is the same, there may be alignment problems handled by
Cobol, but not C. IIRC, it''s been at least 20 years since I did
any Cobol. Not greatly missed.


I do miss writing in Cobol, and I miss it quite pleasantly TYVM.

--
+----------------------------------------------------------------+
| Charles and Francis Richmond richmond at plano dot net |
+----------------------------------------------------------------+


这篇关于允许未命名的struct成员?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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