> Now the MVI makes absolutely no sense to me.

It makes the string initialized to the null string (""), no?

Charles

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:ibm-m...@bama.ua.edu] On Behalf
Of Bernd Oppolzer
Sent: Tuesday, May 18, 2010 12:14 PM
To: IBM-MAIN@bama.ua.edu
Subject: partially initialized structures in C (3)

Sorry for the missing line feeds.

C statement:
*    scp1215ein           in1215     = { 0 };
Pseudo ASSEMBLER (structure starts at 272(r13)):
ST    r6,<a5:d272:l4>(,r13,272)
MVI   <a5:d276:l1>(r13,276),0

C statement:
*    scp1215aus           out1215    = { 0 };
Pseudo ASSEMBLER (structure starts at 296(r13)):
ST    r6,<a5:d296:l4>(,r13,296)
MVI   <a5:d300:l1>(r13,300),0

Kind regards

Bernd


Bernd Oppolzer schrieb:
> To make it clear:
>
see above

> The ST operations initialize the first components of the structures,
> which are fullwords. This is what should be done, according to
> the IBM C language reference.
>
> The rest of the structures should remain unchanged (uninitialized),
> according to IBM's language reference, and should be set to zero,
> according to ANSI C language reference. The structure out1215,
> for example, is 24 bytes long.
>
> Now the MVI makes absolutely no sense to me.
>
> It would only make some sense, if it was followed by an overlapped MVC
> instruction, which would set the rest of the structure to zero. But 
> such a
> instruction is not generated by the compiler.
>
> ???
>
> Kind regards
>
> Bernd
>
>
>
>
> Bernd Oppolzer schrieb:
>> Hello all,
>>
>> sorry for asking this question on IBM-Main, but the C370 list is so 
>> silent
>> that I doubt that anyone is actually listening.
>>
>> We observed a sort of problem today which showed up as a 0C4 abend
>> due to a not proper initialized pointer component of a C structure.
>>
>> Further examination showed that the structured was initialized as 
>> follows
>>
>> structure_type  structure_identified = { 0 };
>>
>> The structure has several components; the last component is the pointer.
>>
>> According to the IBM C language reference, only the first component is
>> initialized to zero, and the other components have random contents,
>> because the storage class is automatic. The compiler generates only
>> initialization logic for the first few bytes of the auto structure. 
>> So from this
>> point of view, everything is right.
>>
>> But: the ANSI C language reference, for example in the Kernighan Ritchie
>> book appendix, and most other C language references I found on the web,
>> clearly state that if the number of initializers on structure 
>> initialization is less
>> than the number of structure components, the remaining components are
>> initialized to zero, even for auto structures.
>>
>> This is not an error in that sense that the compiler does not what is 
>> written
>> in the language reference, but instead it is a contradiction between 
>> IBM's
>> language reference and ANSI language reference.
>>
>> What do you think about this? Does it make sense to complain at IBM
>> about it? We have hundreds of C programs in production use which use
>> this kind of initialization (maybe) and now we are afraid that we 
>> need to
>> examine all these programs.
>>
>> Kind regards
>>
>> Bernd
>>
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
> Search the archives at http://bama.ua.edu/archives/ibm-main.html
>

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to