Storage for uninitialized objects (PR 24626)

Robert Dewar dewar@adacore.com
Sun Jan 15 19:43:00 GMT 2006


John David Anglin wrote:

> This seems pretty clear. C99 requires that storage be allocated
>
>for uninitialized objects, that an indeterminate value be stored
>in the object when the declarator for the object is reached in the
>block, that the last-stored value be retained for the duration of
>the block.
>  
>
I think that is an incorrect interpretation. Remember the standard is
always "as-if" when it gives an implementation approach. Please
show a correct C program that can tell that gcc is not following
the above scheme.

>Now, the argument being advanced here is that this is all irrelevant
>since the use of an indeterminate value constitutes undefined behavior
>and GCC can pretty much do anything.  However, "undefined behavior"
>is conditional on the standard not imposing requirements on the construct,
>data or object.  Further, I think the general intent was that
>implementations be as portable as possible.
>  
>
Obviously the "as possible" is the operable word here, or you would not find
undefined in the standard. Undefined is always about non-portability.

>Dave
>  
>




More information about the Gcc mailing list