Yes, with respect to the IBM description, it works correct.

But the IBM description is wrong with respect to the ANSI C definition.
I also checked the language references of some other compilers,
that is, SGI or Microsoft. In all other cases, the remaining structure components are initialized with zero. This is the ANSI standard. I believe IBM is simply wrong.

BTW: this is the case with ALL IBM compilers, even C99 on AIX etc. -
probably the same compiler, only another code generation pass.

IMHO, even IBM's compilers should follow the rules of the ANSI standard -
they pretend to be ANSI compliant, so they should be.

Kind regards

Bernd



McKown, John schrieb:
Well, from my reading of the IBM manual, it specifically states that:

<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.
</quote>

I think this means that it is WAD (or BAD - Broken As Designed). You'd need IBM 
to agree to fix the compiler. I can't tell because I don't have a copy of the 
actual ANSI C reference. Oh, are you running with C99? I.e. LANGLVL(EXTENDED)? 
I don't know if that would make a difference or not. I don't have the C 
compiler here.

--
John McKown Systems Engineer IV
IT


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