From 1751911008101497376
X-Google-Thread: f78e5,e2cfdf64f67c7793
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.speakeasy.net!news.speakeasy.net.POSTED!not-for-mail
NNTP-Posting-Date: Tue, 28 Sep 2004 09:00:11 -0500
Return-Path: <devnull@Algebra.Com>
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
Date: Tue, 28 Sep 2004 13:53:11 GMT
Delivered-To: std-c++@ucar.edu
Received-SPF: none (mailbox8.ucsd.edu: domain of mod-submit@uni-berlin.de does not designate permitted sender hosts)
From: Peter van Merkerk <merkerk@deadspam.com>
Newsgroups: comp.std.c++
Subject: Re: Eliminating uninitialised variables
Message-ID: <2rsojaF1cph0rU1@uni-berlin.de>
References: <memo.20040920104138.384A@brangdon.m> <41573b0a$0$29917$cc9e4d1f@news.dial.pipex.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Orig-X-Trace: news.uni-berlin.de NvckrKwU+EP1N/sKokT8YgGXsmEBjbqfDgHNreRZGzzzmh8vmq
User-Agent: Mozilla Thunderbird 0.7.2 (Windows/20040707)
X-Accept-Language: en-us, en
X-Spamscanner: mailbox8.ucsd.edu  (v1.5 Aug 25 2004 09:28:35, -2.8/5.0 3.0.0-rc1)
X-MailScanner: PASSED (v1.2.8 80801 i8S9IZvx097434 mailbox8.ucsd.edu)
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
X-Spam-Checker-Version: SpamAssassin 2.64 (2004-01-11) on manifold.algebra.com
X-Spam-Status: No, hits=0.0 required=3.0 tests=none autolearn=no version=2.64
Lines: 41
NNTP-Posting-Host: 64.81.147.48
X-Trace: sv3-NsXknXl9nURRVmDVsMFKezh69CBxf8VVuYDnovb+KMT8qk+kjA2Oz7IMWwtSWQlprW8VuP4Z3sSNnOU!KgwejBIYbkpRT9yt2Le0jVvqOlac3Qv3yFpobE1hWMKWKI9svWf/FrWHVizfmzHnXd7mR0v1He6b!UKdbQETW
X-Complaints-To: abuse@speakeasy.net
X-DMCA-Complaints-To: abuse@speakeasy.net
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.13
Xref: g2news1.google.com comp.std.c++:2893

Stephen Howe wrote:

>>We can't require the compiler to reject (at compile time) accesses of
>>uninitialised variables without breaking existing code, so I think we
>>would instead have to require all variables to be initialised -
>>zero-initialised as if they were statics.
> 
> And does zero-initialising mean that the program is correct or will behave 
> more correctly? No.

It would lead to more predictable (not necessarilly correct) behavior. 
It doesn't fix bugs, but it would simplify locating them.

> I don't see that this gains anything.
> 
> I have to say in the past 5 years, I have not been bitten once by 
> "uninitialised variables".

That doesn't mean there aren't any in the code you written, and it might 
surface at the worst possible time. The problem with uninitialized 
variables is that the code may work just fine on your system, and pass 
all tests and yet blow up in the face of the customer. If you lurk 
around newsgroups you do see every now and then people asking why debug 
builds work fine and release builds fail miserably. This is typically 
caused by uninitialized variables.

> It is not a signicant problem to me.

Your (or mine) experiences are not necessarily representative for the 
rest of the world.

-- 
Peter van Merkerk
peter.van.merkerk(at)dse.nl

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]



