From 4255569505018976808
X-Google-Thread: f78e5,e2cfdf64f67c7793
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.icl.net!newsfeed.freenet.de!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: merkerk@deadspam.com (Peter van Merkerk)
Newsgroups: comp.std.c++
Subject: Re: Eliminating uninitialised variables
Date: Mon, 11 Oct 2004 18:20:26 GMT
Lines: 46
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <2sv02rF1pk7qhU1@uni-berlin.de>
References: <memo.20040920104138.384A@brangdon.m> <41573b0a$0$29917$cc9e4d1f@news.dial.pipex.com> <2rsojaF1cph0rU1@uni-berlin.de> <4166ebbe$0$237$edfadb0f@dread12.news.tele.dk>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.demon.co.uk 1097518830 12698 158.152.254.254 (11 Oct 2004 18:20:30 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Mon, 11 Oct 2004 18:20:30 +0000 (UTC)
X-Received-SPF: none (mailbox3.ucsd.edu: domain of mod-submit@uni-berlin.de does not designate permitted sender hosts)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-User-Agent: Mozilla Thunderbird 0.7.2 (Windows/20040707)
X-Spam-Checker-Version: SpamAssassin 2.64-mulga_r1 (2004-01-11) on 
	mulga.cs.mu.OZ.AU
X-Orig-X-Trace: news.uni-berlin.de bB0zkXa30ifRfRXYG19LIATWZlZB+mj+x/+AAT+do77xYNIDkc
X-Spam-Status: No, hits=-4.9 required=5.0 tests=BAYES_00 autolearn=ham 
	version=2.64-mulga_r1
X-Accept-Language: en-us, en
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id i9BIKQd3029635;
	Tue, 12 Oct 2004 04:20:26 +1000 (EST)
X-Path: comp-std-cpp-robomod!not-for-mail
X-Delivered-To: std-c++@ucar.edu
X-Spamscanner: mailbox3.ucsd.edu  (v1.5 Aug 25 2004 09:28:35, -2.8/5.0 3.0.0-rc1)
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Newsgroups: comp.std.c++
X-MailScanner: PASSED (v1.2.8 86578 i9B8sr8h097982 mailbox3.ucsd.edu)
Xref: g2news1.google.com comp.std.c++:3043

Esben Mose Hansen wrote:
> Peter van Merkerk wrote:
> 
> 
>>Stephen Howe wrote:
> 
> 
>>>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.
> 
> http://valgrind.kde.org/ would be your friend, here. As a bonus, your code
> get tested for memory leaks, too.

AFAIK valgrind does not do static code analysis, only run-time checking 
and only on one platform. It may be a valuable tool if you happen to be 
using that platform. Run-time checks (valgrind is only one of a great 
many tools for this) have their limitations since it won't detect errors 
in code that doesn't get executed. It is however no replacement for 
static code analysis (such as lint).

> Once upon a time, it was said that one tool should do one job only. Now a
> days compilers seems to be required to do some (rather poor) linting as
> well. Why is this?

A compiler is no replacement for a static code analysis tool, but that 
is not the point of this discussion. The point being discussed here is 
should C++ continue to default to unpredicatable behaviour or not?

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



