> -----Original Message-----
> From: IBM Mainframe Discussion List 
> [mailto:ibm-m...@bama.ua.edu] On Behalf Of Thomas David Rivers
> Sent: Wednesday, May 19, 2010 8:40 AM
> To: IBM-MAIN@bama.ua.edu
> Subject: Re: partially initialized structures in C
> 
> Bernd,
> 
>   That sounds like a compiler bug, but more detail would
>   be needed to be sure.
> 
>   The ANSI C standard basically works like this:
> 
>     A structure initialized a file scope (static or not) will be
>     initialized to all zeros.
> 
>     If the structure is being initialized within a function
>     (at automatic scope) then the requirement is that it be
>     initialized the same as if it were done at file scope,
>     which basically means if you initialize part of it, you
>     have to initialize the "holes" with 0.
> 
>   I'm surprise the IBM documentation would indicate
>   that a partial aggregate initialization only partially
>   initializes - can you point me to the pertinent
>   phrases in the IBM doc?   The requirement to initialize
>   the remainder of the aggregate with zeros has been
>   around since the very first ANSI C standard.
> 
>       - Dave Rivers -

Ref:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/CBCLR190/4.6.3

<quote>
You do not have to initialize all members of a structure or union; the initial 
value of uninitialized structure members depends on the storage class 
associated with the structure or union variable. In a structure declared as 
static, any members that are not initialized are implicitly initialized to zero 
of the appropriate type; the members of a structure with automatic storage have 
no default initialization. The default initializer for a union with static 
storage is the default for the first component; a union with automatic storage 
has no default initialization. 
</quote>

--
John McKown 
Systems Engineer IV
IT

Administrative Services Group

HealthMarkets(r)

9151 Boulevard 26 * N. Richland Hills * TX 76010
(817) 255-3225 phone * (817)-961-6183 cell
john.mck...@healthmarkets.com * www.HealthMarkets.com

Confidentiality Notice: This e-mail message may contain confidential or 
proprietary information. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message. 
HealthMarkets(r) is the brand name for products underwritten and issued by the 
insurance subsidiaries of HealthMarkets, Inc. -The Chesapeake Life Insurance 
Company(r), Mid-West National Life Insurance Company of TennesseeSM and The 
MEGA Life and Health Insurance Company.SM

 

----------------------------------------------------------------------
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