Path: csiph.com!news.mixmin.net!border2.nntp.ams1.giganews.com!border1.nntp.ams1.giganews.com!nntp.giganews.com!buffer1.nntp.ams1.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail NNTP-Posting-Date: Fri, 17 Jun 2016 00:13:30 -0500 From: Gareth Owen Newsgroups: comp.lang.c Subject: Re: setting pointers to NULL and testing question. References: <31b753b3-2d70-40f3-885e-2a75b98cf739@googlegroups.com> Date: Fri, 17 Jun 2016 06:13:30 +0100 Message-ID: <8760t84cud.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:oxxMDMviFolh/gbB1HvIDe4TgK8= MIME-Version: 1.0 Content-Type: text/plain Lines: 22 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-uYeKLnNJsBuX6/yr6C5RTeouFJQcsS7sx0Wn5+jpYcxhHRCbtAk3RSotKhu//NChSeWRwMME/meG6vT!/DFOd/ftBeCZeKDBxBRl2TNptSmb7oKA5+THKfK0g66BC6Ohkp6+vMbDEObpHa+vb5eyoA== 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.40 X-Original-Bytes: 2164 Xref: csiph.com comp.lang.c:89366 Tim Rentsch writes: >> Counter: >> If an uninitialized variable is used before being initialized, in a way >> that the compiler can't catch - it will cause problems. [...] > > There are no such cases. There are no cases a compiler *can't* catch. There are cases that compilers don't catch[0]. Most notably, if a pointer to an uninitialized variable is passed to a function defined in a different translation unit. > A conservative analysis can catch every situation where a variable > might be used before being given an initial value, provided of course > that we are willing to tolerate some false positives. A sufficiently good compiler .... Nevertheless, no existing compiler known to me does such an exhaustive search. [0] There are also cases that a single compiler sometimes catches, depending on which compiler flags you use. Optimisations often catch extra things.