Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!bloom-beacon.mit.edu!panix!not-for-mail From: Grant Edwards Newsgroups: comp.lang.python Subject: Re: Python Front-end to GCC Date: Tue, 22 Oct 2013 18:58:19 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 44 Message-ID: References: <4012031f-5334-4be8-a673-e0d8c8917fb2@googlegroups.com> <5264dbbe$0$30000$c3e8da3$5496439d@news.astraweb.com> <5265bba8$0$29981$c3e8da3$5496439d@news.astraweb.com> <526668e5$0$29981$c3e8da3$5496439d@news.astraweb.com> <52669852$0$29981$c3e8da3$5496439d@news.astraweb.com> NNTP-Posting-Host: dsl.comtrol.com X-Trace: reader1.panix.com 1382468299 17555 64.122.56.22 (22 Oct 2013 18:58:19 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Tue, 22 Oct 2013 18:58:19 +0000 (UTC) User-Agent: slrn/1.0.1 (Linux) Xref: csiph.com comp.lang.python:57300 On 2013-10-22, Neil Cerutti wrote: > On 2013-10-22, Steven D'Aprano wrote: >> On Tue, 22 Oct 2013 14:04:57 +0000, Dave Angel wrote: >>> but here you go on to say the C code is unsafely skipping >>> initialization, which is not the case. >> >> Are you talking generically, or specifically about the C code >> referenced in the link I gave? >> >> "Memory is always zeroed" is one of the advantages of Go over C and C++, >> at least according to Rob Pike: >> >> http://commandcenter.blogspot.com.au/2012/06/less-is-exponentially- >> more.html > > Go initializes variables to defined zero values, not simply to > all-bits zero as (I think) C does. C initializes to defined zero values. For most machines in use today, those values _happen_ to be all-bits-zero. This makes the implementation trivial: chuck them all into some pre-defined section (e.g. ".bss"), and then on startup, you zero-out all the bits in the section without having to know what's where within that section. If you design a machine such that integer, pointer, and FP representations where 0, NULL, and 0.0 are all zero-bits, then life get's tougher for the guys writing the compiler and startup code. But the language doesn't require or assume that initializer values are all-bits-zero. FP values have to be initizliaed to 0.0. Int's have to be initialized to integer value 0, pointers have to be initialized to (void*)0. Nowhere it the languauge is it required or assumed that any or all of those values are all represented by contiguous blocks of all-zero-bits. > This isn't as great a feature as it seems, since the zero value for > some built in types, e.g., map, is unusable without manual > construction. In addition, you can't define a zero value for your own > types. -- Grant Edwards grant.b.edwards Yow! Oh my GOD -- the at SUN just fell into YANKEE gmail.com STADIUM!!