Path: csiph.com!news.nrbbs.org!border-4.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-3.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 23 Aug 2026 20:01:18 +0000 From: steve g Newsgroups: comp.lang.c Subject: Re: Initialization Of Static Pointer Variables References: <11681np$3s8jk$4@dont-email.me> <11683d0$jki7$1@artemis.inf.ed.ac.uk> <116a7vj$iojj$1@dont-email.me> <116c07d$1274o$1@dont-email.me> Date: Sun, 23 Aug 2026 16:01:18 -0400 Message-ID: <87y0dwsj1t.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:6GuBLhP+PwIgWsRo+9RccNJykVA= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Lines: 28 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-eBRCebPeNqz52qqUX2mLZnpwFbA9A/E+/S2EhwWFvM2FpA4yjKiHAWKTod1mY9+h/IM8pk9O3se9js7!E6f0+7Cfgzsqw1zTShQUW4ZX8vf6PYIiLpkVLSh4jNacH9o= X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html 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 Xref: csiph.com comp.lang.c:401444 David Brown writes: > On 21/08/2026 21:12, Chris M. Thomasson wrote: >> On 8/20/2026 4:42 PM, Richard Tobin wrote: >>> In article <11681np$3s8jk$4@dont-email.me>, >>> Lawrence D;Oliveiro  wrote: >>> >>>> The spec also says that all static variables are initialized to zero >>>> at program start time. Are pointer variables allowed to be given an >>>> all-zero bit pattern at this time? Or are they supposed to be >>>> initialized to the NULL value (if that's different) instead? >>> >>> ISO C 1999, 6.7.8: >>> >>> If an object that has automatic storage duration is not initialized >>> explicitly, its value is indeterminate. If an object that has static >>> storage duration is not initialized explicitly, then: >>> >>> — if it has pointer type, it is initialized to a null pointer; >> Oh. I must have missed that one. >> so: >> static void* g_ptr; >> is guaranteed to be nullptr? Just to clarify... >> > Yes. I would still recomend memset or bzero. You never know what is complient or not - better to be safe then sorry.