🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2930

Re: uninitialized++;

#2930
From: Mike Ball
Date: Wed, 30 Dec 1992 17:21
21 lines
1241 bytes
diamond@jit533.jit.dec.com (Norman Diamond) writes:

>In article <9236508.13290@mulga.cs.mu.OZ.AU> fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
>>hbf@gandalf.uio.no (Hallvard B Furuseth) writes:
>>>Can this fail  - on some machine?  - in ANSI?
>  main () { int uninitialized; uninitialized += 0; return 0; }
>I think this one is not allowed to fail.

To quote from the standard., section 1.6
"Undefined behavior - behavior, upon use of a nonportable or erroneous
program construct, or erroneous data, or of indeterminately valued objects,
for which the standard imposes no requirements."

And 3.5.7
"If an object that has automatic storage duration is not initialized
explicitly, its value is indeterminate."

Sounds like any use of the value, even adding 0, is undefined.
-- 
Michael S. Ball (mike@taumet.com)
TauMetric Corporation
Technical Details
Message-ID: <1992Dec30.172142.22789@taumet.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!taumet!mike
References: <HBF.92Dec29211517@gandalf.uio.no> <9236508.13290@mulga.cs.mu.OZ.AU> <C02DDv.2Kw@jrd.dec.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c,comp.lang.c
Path: arc1-ca.pugleaf.net!sparky!uunet!taumet!mike
From: mike@taumet.com (Mike Ball)
Subject: Re: uninitialized++;
Message-ID: <1992Dec30.172142.22789@taumet.com>
Organization: TauMetric Corporation
References: <HBF.92Dec29211517@gandalf.uio.no> <9236508.13290@mulga.cs.mu.OZ.AU> <C02DDv.2Kw@jrd.dec.com>
Date: Wed, 30 Dec 1992 17:21:42 GMT
Lines: 21