Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: "marb...@yahoo.co.uk" Newsgroups: comp.compilers Subject: Re: another C-like language? was Compilers :) Date: Sun, 15 Jan 2023 04:26:48 -0800 (PST) Organization: Compilers Central Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <23-01-060@comp.compilers> References: <23-01-001@comp.compilers> <23-01-002@comp.compilers> <23-01-003@comp.compilers> <23-01-008@comp.compilers> <23-01-016@comp.compilers> <23-01-029@comp.compilers> <23-01-033@comp.compilers> <23-01-034@comp.compilers> <23-01-040@comp.compilers> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="39257"; mail-complaints-to="abuse@iecc.com" Keywords: C, optimize Posted-Date: 15 Jan 2023 13:11:12 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com In-Reply-To: <23-01-040@comp.compilers> Xref: csiph.com comp.compilers:3328 On Wednesday, 11 January 2023 at 23:10:38 UTC, David Brown wrote: > The same applies to C and C++ programming, when using static error > checking. (And during development, you should definitely be using a > compiler capable of spotting missing initialisations, and you should > treat such warnings as bugs in your code.) And like Java tools, C and > C++ compilers are not /quite/ perfect :-) > > So I agree that there are occasional uses for such "artificial" > initialisation. There are also occasions when declaring a variable > without initialising makes sense because you will later set its value > inside a conditional. Indeed. I've occasionally had compilers complain about uninitialised variables though I could see that my (rather perverse?) code did always initialise them before they were used (but possibly not if they weren't). In such cases, I've added an initialisation to the declaration just to shut the compiler up. (Warnings of uninitialised variables usually do indicate bugs.)